Opened 4 weeks ago
Closed 3 weeks ago
#65902 closed defect (bug) (fixed)
Customizer: Widgets 'Reorder' and 'Add a widget' buttons visual order and DOM order mismatch
| Reported by: | afercia | Owned by: | afercia |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Customize | Version: | |
| Severity: | normal | Keywords: | has-screenshots has-patch |
| Cc: | Focuses: | accessibility, css |
Description
In the Customizer > Widgets panel, the visual order and DOM order of the two buttons 'Reorder' and 'Add a widget' mismatches.
- 'Add a widget' is first in the DOM but visually after 'Reorder'.
- 'Reorder' is second in the DOM but visually before 'Add a widget'.
For keyboard users, visual and DOM order must match,
The two buttons also look a little misaligned.
A similar problem occurs in the Menus panel. The CSS is different though. In the Menus, there is a flex container that uses `flex-direction: row-reverse'. That is going to be fixed in https://github.com/WordPress/wordpress-develop/pull/13129
Instead, in the Widgets panel the buttons use floats. For consistency and better alignment, it would be good to add a flex container as done for Menus.
To reproduce:
- Install and activate the Classic Widgets plugin.
- Activate Twenty Twenty-One to have access to the Customizer.
- Go to Appearance > Customize > Widgets
- Observe the two buttons are misaligned.
- Use the Tab key to navigate the UI.
- Observe the focus lands first on the button on the right and then on the button on the left.
Attachments (1)
Change History (9)
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
4 weeks ago
This ticket was mentioned in PR #13135 on WordPress/wordpress-develop by @khokansardar.
4 weeks ago
#3
- Keywords has-patch added
@khokansardar commented on PR #13135:
4 weeks ago
#5
Nice PR, thank you. Just needs a few minor adjustments to the CSS.
Both done. Added gap: 8px to match the Nav menus buttons, and removed float: right from .add-new-widget/.add-new-menu-item and .reorder-toggle. I also reduced the add buttons' margin: 0 0 0 10px to margin: 0, since that margin only existed for the floats — with it in place the Nav menus buttons were actually 18px apart (10px margin + 8px gap), so both panels now sit at a real 8px.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In the Customizer's Widgets panel, the "Add a Widget" and "Reorder" buttons are laid out with CSS floats, so their DOM order (Add, then Reorder) doesn't match their visual order (Reorder, then Add); this breaks keyboard tab order, and the buttons also sit slightly out of vertical alignment.
WP_Widget_Area_Customize_Control::render_content()now wraps both buttons in a.customize-control-widgets-buttonscontainer and outputsReorderbeforeAdd a Widget, matching the visual order; a new flex rule incustomize-controls.cssreplaces the floats, right-aligning and vertically centering the pair the same way the Menus panel does.The equivalent Menus buttons have the same float-based mismatch, but that's already covered by a separate ticket and PR, so this change is limited to the Widgets panel.
Trac ticket: https://core.trac.wordpress.org/ticket/65902
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: implementing the CSS/markup fix and verifying the DOM/visual order and button alignment against the running Customizer. All changes were reviewed and validated by me.