Skip to content

Fix Overview keyboard navigation and focus trapping - #338

Merged
AllTerrainDeveloper merged 7 commits into
WordPress:trunkfrom
KarunyaChavan:fix/overview-keyboard-accessibility
Jul 14, 2026
Merged

Fix Overview keyboard navigation and focus trapping#338
AllTerrainDeveloper merged 7 commits into
WordPress:trunkfrom
KarunyaChavan:fix/overview-keyboard-accessibility

Conversation

@KarunyaChavan

@KarunyaChavan KarunyaChavan commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR fixes two a11y issues that make the Overview mode keyboard-inaccessible: Tab traverses the entire hidden admin chrome before reaching desktop tiles, and the close X button on each tile is unreachable via keyboard.

Closes #331

Why?

Two root causes:

  • no inert is applied to background elements when Overview opens.
  • the close X is nested inside the tile , which browsers skip in Tab order.

How?

  • On overview enter, inert is set on the admin menu, docks, widgets, footer, and all #wpbody-content children and removed on exit.
  • The close X is extracted from inside the tile <button> into a sibling <button> under a wrapper <div>, so both are independently reachable by Tab.
  • The global Enter handler now delegates to native clicks instead of intercepting them, fixing a third issue where pressing Enter on the close button would exit overview instead of closing the desktop.
  • The inert-toggling logic is deduplicated into a shared constant and helper.

KarunyaChavan and others added 3 commits July 10, 2026 17:22
- Applies `inert` to left admin menu, shell siblings in `#wpbody-content`, and iframes upon entering Overview to prevent Tab from traversing invisible elements.
- Extracts the desktop tile close 'X' into a native `<button>` sibling (rather than an inner `<span>`) so it is reachable via Tab.
- Updates the global `Enter` listener to let native click events fire when a `<button>` is actively focused.
- OVERVIEW_INERT_ELEMENTS constant replaces two inline arrays
- inertWpBodyContentChildren helper replaces two inline loops
- Use .inert property only (removes redundant setAttribute/removeAttribute)
- Use .inert property for window elements (was setAttribute only)
- Remove redundant tabindex="0" on native <button>
- Add adminmenuback and desktop-mode-widgets to inert list
@KarunyaChavan
KarunyaChavan marked this pull request as ready for review July 13, 2026 14:03

@AllTerrainDeveloper AllTerrainDeveloper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thank you again! I can see a regression added by this pull request. If we have 3 opened windows and one of them is minimized, if we click on the minimized one, it's not restored.

See video:
https://github.com/user-attachments/assets/ef337ca2-2dbb-42c8-b0c4-411d33f77307

A second thing is that we have a rule which is to add tests with each new change :)

Would you mind?

@KarunyaChavan

KarunyaChavan commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

I can see a regression added by this pull request. If we have 3 opened windows and one of them is minimized, if we click on the minimized one, it's not restored.

@AllTerrainDeveloper This is actually a core bug - you can reproduce it on the latest trunk as well. I already discussed this in #311, and I've opened PR #312 to address it.

KarunyaChavan and others added 2 commits July 13, 2026 22:09
…gation.

- enterOverview/exitOverview correctly toggle inert on background chrome
  elements, wpbody-content children, and all windows.
- Each desktop tile wrapper contains two sibling <button>s (tile + close X).
- Enter while focused on a real close button does not exit overview.
- enterOverview tolerates a missing #wpbody-content element.
@AllTerrainDeveloper

AllTerrainDeveloper commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Oh Thank you! Didn't realise! too much work lately on Desktop Mode 🤣

@AllTerrainDeveloper
AllTerrainDeveloper merged commit 69e3390 into WordPress:trunk Jul 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overview keyboard navigation issues

2 participants