Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#29632 closed defect (bug) (fixed)

wpColorPicker does not respect `hide` option

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


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:

  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 10 years ago.

Download all attachments as: .zip

Change History (9)

10 years ago

#1 @tollmanz
10 years ago

Added a patch to respect the hide option.

#2 @helen
10 years ago

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

#3 @tollmanz
10 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
10 years ago

  • Focuses javascript added

#5 @DrewAPicture
10 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
10 years ago

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

#7 @azaozz
10 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
9 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:

Note: See TracTickets for help on using tickets.