[wp-trac] [WordPress Trac] #48896: When enqueued wp-color-picker, toggle response of each widget panel is unresponsive on customizer.

WordPress Trac noreply at wordpress.org
Fri Apr 15 01:45:55 UTC 2022


#48896: When enqueued wp-color-picker, toggle response of each widget panel is
unresponsive on customizer.
---------------------------------------+---------------------
 Reporter:  inc2734                    |       Owner:  (none)
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:  6.0
Component:  Customize                  |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch needs-testing  |     Focuses:
---------------------------------------+---------------------

Comment (by costdev):

 Testing on Firefox (Windows) DevTools (Galaxy S20 Linux), I was able to
 produce incorrect multi-click behaviour.

 1. Navigate to `Appearance > Customize > Widgets`.
 2. Double-click on the widget header.

 Expected behaviour was either:
  1. Open the widget and ignore the second click.
  2. Open the widget and close it again.

 Actual behaviour: The widget opened, closed and opened in quick
 succession.

 This appears to be due to the `expanded` class not being applied until
 after the animation is complete.

 First click:
  - Toggle button: "My `aria-expanded` isn't true, open the widget."
  - Widget: "I don't have the `expanded` class yet, open me."

 Second click while still animating:
  - Toggle button: "My `aria-expanded` is true, close the widget."
  - Widget: "I don't have the `expanded` class yet, open me."

 In this situation, the toggle button is the source of truth.

 Changing `if ( expanded )` to `if ( $toggleBtn.attr( 'aria-expanded' ) ===
 'false' )` is what fixed it for me. I'll attach a patch in just a moment.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48896#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list