Repository navigation
refactor(ModalAnnounceProvider): watch presentation through the shared MutationObserver - #9151
Conversation
…d MutationObserver The provider's open/inert/aria-hidden watch now registers through observeMutations, Core's one observer per set of options, instead of a raw MutationObserver per open modal. The session still starts at the open intent and ends at the real close or unmount (runtime INV5 test unchanged). Test: two open modals register both dialogs with one observer. Co-authored-by: imdreamrunner <imdreamrunner@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Looks good to merge: moving the modal presentation watch onto Core's shared observeMutations keeps announcement routing inside modals unchanged, and the new test fails on main and passes here. No changes are needed. CI skipped its lint, typecheck and test jobs on this draft head.
[Automated review]
There was a problem hiding this comment.
Looks good to merge: moving the modal presentation watch onto Core's shared observeMutations leaves announcement routing inside modals unchanged, and the new test fails without the change and passes with it. No changes are needed; the lint, typecheck and test jobs were cancelled on this head, so they still need a green run before merging.
[Automated review]
Maintainer impact
ModalAnnounceProvidercreates its ownMutationObserverfor each open modal to followopen,inertandaria-hidden. Core already hassharedMutationObserver.observeMutations, which keeps one observer per set of options for every registration. Two owners of the same concern drift apart: the shared one gets fixes, and the copy doesn't. Users see no change.Intended invariant
Announcements inside open modals route exactly as before (
spec:AST-086FR14). The presentation watch starts at the open intent, follows the exit, and ends at the real close or unmount (architecture:react-component-runtimeINV5).Change
observeMutations(dialog, {attributes, attributeFilter: ['open', 'inert', 'aria-hidden']}, onPresentationChange). The session'sstopreleases that registration.sharedMutationObserverheader now names this consumer.[chore]crediting @imdreamrunner, who wrote the provider in fix(core): useAnnounce delivers inside the open Astryx modal that encloses its caller #8009.Evidence
Scope
Testing
pnpm vitest run packages/core/src/hooks packages/core/src/Dialog packages/core/src/BottomSheet packages/core/src/Drawer packages/core/src/Lightbox; strict eslint andtscclean.