[wp-trac] [WordPress Trac] #46780: wpColorPicker() close() method uses iris 'toggle' instead of 'hide' which can unexpectedly open the color pane

WordPress Trac noreply at wordpress.org
Wed Apr 3 07:09:04 UTC 2019


#46780: wpColorPicker() close() method uses iris 'toggle' instead of 'hide' which
can unexpectedly open the color pane
--------------------------+-----------------------------
 Reporter:  maximus80     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.1
 Severity:  minor         |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 Using the close() method, one would expect that the color picker will get
 closed anyway and that nothing else would happen, even if the picker in
 question was already closed. However, when calling the close() method on
 an already closed picker (e.g. when you call close() on a set of three
 pickers, where only 2 might be open), the color pane will get displayed.

 While the close() method correctly will remove the wp-picker-open class
 and will set the aria-expanded attribute to false regardless, the actual
 iris picker is just using toggle:
 {{{
 this.element.iris( 'toggle' );
 }}}


 Instead, it would be safer to use

 {{{
 this.element.iris( 'hide' );
 }}}

 which would also be more in line with how the class and attribute are
 handled.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46780>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list