WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#29632 closed defect (bug) (fixed)

wpColorPicker does not respect `hide` option

Reported by: tollmanz Owned by: azaozz
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch dev-feedback
Focuses: javascript Cc:

Description

wpColorPicker() appears to support the hide option by listing it in the options property. When iris is initialized, the hide value is hardcoded and not taken from the options array. wpColorPicker() should respect the hide value passed to it.

To reproduce, initialize a wpColorPicker() with the following code:

$input.wpColorPicker({
  hide: true
});

Notice that the color picker is in the closed state. It should be opened when hide is passed.

Attachments (1)

29632.diff (401 bytes) - added by tollmanz 5 years ago.

Download all attachments as: .zip

Change History (9)

@tollmanz
5 years ago

#1 @tollmanz
5 years ago

Added a patch to respect the hide option.

#2 @helen
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.1

#3 @tollmanz
5 years ago

In looking at this some more, I see that there is code that attempts to trigger the click event on the "toggle" element, effectively opening the color picker; however, it is tricky to consistently trigger such an event on a hidden element, which was a requirement in my case.

Respecting the hide option by passing it to the iris() function still seems to be a valid solution.

#4 @DrewAPicture
5 years ago

  • Focuses javascript added

#5 @DrewAPicture
5 years ago

  • Keywords dev-feedback added
  • Owner set to azaozz
  • Status changed from new to reviewing

Patch still applies.

@azaozz: Care to take a look at the viability of this?

#6 @azaozz
5 years ago

This looks like a typo, the hide option is set in the defaults but never used.

#7 @azaozz
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 29879:

Fix support for the hide option in wpColorPicker, props tollmanz, fixes #29632

#8 @jtsternberg
5 years ago

I see no reason any of the options passed to iris should be hard-coded. They should all respect the params passed to wpColorPicker. As such, I've created a new ticket: https://core.trac.wordpress.org/ticket/30182

Note: See TracTickets for help on using tickets.