Opened 6 years ago
Closed 6 years ago
#32943 closed defect (bug) (fixed)
Menu Customizer: reorder buttons tabindex not set for just added items
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch commit |
Focuses: | accessibility, javascript | Cc: |
Description
Just noticed when you add a new item to a menu, the just-added item reorder buttons don't get any tabindex attribute. This results in all 4 reorder buttons being focusable when using a keyboard. See screenshot below.
When adding more than one item, seems just the last one doesn't get the tabindex attributes.
Attachments (2)
Change History (10)
#4
@
6 years ago
- Keywords has-patch 2nd-opinion added; needs-patch removed
- Owner set to valendesigns
- Status changed from new to assigned
The issue here seems to be a race condition. The menu item is not yet added to the UI when the tabIndex code is executed. By adding a short delay in 32943.diff I was able to get things to work correctly.
This ticket was mentioned in Slack in #core-customize by valendesigns. View the logs.
6 years ago
#6
@
6 years ago
- Keywords needs-testing added; 2nd-opinion removed
@valendesigns In 32943.2.diff I introduce a new Customizer event pane-contents-reflowed
which gets triggered when wp.customize.reflowPaneContents()
finishes. The menu section then listens for this event and updates the tabIndex
attributes at this time. This should be more robust. I'm noticing, however, that while the tabIndex
attributes are getting set to -1
, the keyboard focus sometimes isn't getting set to an adjacent element that *is* focusable. I suppose this would be a separate issue.
It looks like a new menu item doesn't get added to
menuSection.container
becauseconsole.log( menuSection.container.find( '.menu-item' ).length );
inreflowMenuItems
returns the number of the initial added items.