WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 5 months ago

#46780 new defect (bug)

wpColorPicker() close() method uses iris 'toggle' instead of 'hide' which can unexpectedly open the color pane

Reported by: maximus80 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.1
Component: General Keywords: has-patch
Focuses: javascript Cc:
PR Number:

Description

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.

Attachments (1)

46780.diff (668 bytes) - added by maximus80 5 months ago.

Download all attachments as: .zip

Change History (4)

#1 @desrosj
5 months ago

  • Keywords needs-patch added

Thanks for the report, @maximus80!

Are you interested in creating a patch for this?

#2 @maximus80
5 months ago

Yes, I'll be happy to help :-)

@maximus80
5 months ago

#3 @maximus80
5 months ago

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.