Skip to content

fix: make the chrome's foreground layer a plain div instead of a dialog - #5360

Merged
leaf-agent merged 1 commit into
mainfrom
fix/chrome-foreground-div
Nov 4, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/chrome-foreground-div

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The chrome's foreground layer (it holds the floating panel, hint layers and the chrome's own dialogs) is now a plain div with tabindex="-1". Before, it was an open nonmodal <dialog>. #5336 gave that dialog role="generic" so Chrome would stop exposing it as an unnamed dialog around the panel, but ARIA in HTML permits no such role on dialog, as max-sixty pointed out on #5336. A div is generic natively, so it needs no role.

Nothing still needed the element to be a dialog:

  • Native layers opened inside it (the command reference, page map, popovers) still stand in the top layer, because the browser puts them there no matter what holds them.
  • Nothing calls show/showModal/close on the layer. Its old modal posture (Unify clock presentation and native panel ownership #2006) is gone.
  • The one closest("dialog, [popover]") reader (focus.js, leftClosedLayer) gets the same answer, since an open dialog there already counted as "still standing".

tabindex="-1" stays, so Tab order and focus are unchanged. The layer has no Tab stop, so the Firefox stop removed in #5039 stays gone. A press between the panel's controls still focuses the layer instead of dropping focus to the body. Paint order doesn't change: the layer keeps its place in the chrome and its position: absolute box at the origin. The CSS that cancelled the browser's dialog styling (border, padding, max size, background) goes with the dialog. A stale comment in leaf.js about the hints' "native modal ancestor" goes too.

Verification, on current main:

  • test_borrowed_scroll_stops_leave_code_selection_and_marks_with_their_owners: all three cases pass. It fails when the layer is exposed as a dialog.
  • tests/browser/controls/test_focus.py passes, including the Tab-order test in Chromium and Firefox. So does tests/browser/widgets/test_code_and_documents.py, which includes the zero-dialog check.
  • pnpm run test:runtime and pnpm run check pass.

Refs #5126 and #5336.

The foreground held the panel, hints and chrome dialogs in an open nonmodal
<dialog>. ARIA in HTML permits a dialog no generic role, and a focusable
element's role="presentation" is ignored, so the layer was exposed as an
unnamed dialog around the panel. Nothing still relied on it being a dialog:
the native layers opened inside it stand in the top layer whatever holds
them, and the modal posture it once took is gone. A div is generic natively.

It keeps tabindex="-1": no Tab stop (the Firefox stop #5039 removed stays
gone), and a press between the panel's controls still focuses the layer.
The rules that undid the browser's dialog face go with the dialog.
@leaf-agent
leaf-agent merged commit 8b759a5 into main Nov 4, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/chrome-foreground-div branch November 4, 2026 10:49
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.

1 participant