Repository navigation
feat(component-library): layer overlays with z-index properties and an inert modal layer - #1397
Closed
Arnold Stoba (arnoldstoba) wants to merge 3 commits into
Closed
Arnold Stoba (arnoldstoba) wants to merge 3 commits into
Arnold Stoba (arnoldstoba) wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 6, 2026
…n inert modal layer
Arnold Stoba (arnoldstoba)
force-pushed
the
feat/overlay-layering
branch
from
October 6, 2026 12:12
d0903fa to
49bb664
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
mt-modalmakes the page behind it inert instead of trapping the focus withfocus-trap, and returns the focus to the element that opened it.<body>(select lists, menus, tooltips, date pickers, snackbar) stay usable while a modal is open.--z-index-*custom properties, with the old values as fallback.Why?
focus-trapkept the focus inside the modal element, but Meteor renders menus, select lists and date pickers into<body>, outside of it. In a modal like this, the trap and the menu's own focus handling pulled the focus back and forth, so the menu couldn't be used with the keyboard:Making the page inert, like a native modal dialog does, blocks the background without fighting the overlays.
How?
The new
useModalLayercomposable moves the focus into the panel, wraps Tab, closes the topmost layer on Escape and keeps a reference count of what it made inert. Whenmt-modalopens, it makes every direct child of<body>inert except itself, its backdrop, elements markeddata-mt-overlayand elements that are empty at that moment, like a closed date picker's menu container. Overlays opened later from inside the modal are added to<body>after that and stay usable.Testing?
useModalLayer.spec.ts: focus in and out, Tab wrapping, Escape for the topmost layer, inert reference counting.mt-modal.spec.ts: Escape, the inert page and focus return, and a date picker inside the modal that stays usable.Anything Else?
Please check modals in the Administration. Overlays that other code renders into
<body>before a modal opens become inert unless they carrydata-mt-overlay. #1395 changes the same lines ofmt-snackbar.vue, so whichever merges second needs a small conflict resolution. #1389 is based on this PR and needs a rebase after it is merged.