fix(a11y): give the scheduler's anchored popovers a role, a name and focus - #350
Merged
Merged
Conversation
…focus The quick-info popover rendered as a bare div: no role, no accessible name, and focus never entered it. The overflow popover got that treatment under VCST-5671, but it was applied at that call site rather than shared, so the other two anchored popovers were left behind. All three now carry role="dialog" and a name — the formatted date, the event title, and "New event". Quick-info also moves focus to its close control on open and hands it back to the chip on close; quick-create already focused its title field. The focus entry/restore logic moves out of MonthMorePopover into useAnchoredPanelFocus, now shared by two call sites. It hinges on reading document.activeElement before the DOM patch, while the panel still exists — a second hand-written copy is where that detail gets lost. VcPopover exposes panelEl alongside close(). A call site managing focus needs the teleported panel to answer "is focus still inside?" and cannot reach it any other way. The scheduler's accessibility docs still said no popover applies role=dialog, which stopped being true with #304. Corrected.
|
📦 Preview published for commit Install the preview with dist-tag: npm install @vc-shell/framework@pr-350Or pin to the exact commit: npm install @vc-shell/framework@2.5.0-pr350.bce5a99Published packages (dist-tag
|
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.
Problem
The quick-info popover — opened by clicking an event chip — rendered as a bare
div.vc-popoverwithrole: nullandaria-label: null, and focus never entered it. Its Edit/Delete controls were reachable, so nothing was unreachable; the cost was an unannounced, unnamed surface and a long tab path, since the panel is teleported to the end of the DOM.VCST-5671 fixed exactly this for the "+N more" overflow popover, but at that call site rather than in the shared component, so the other two anchored popovers were left behind. QA flagged quick-create as an uninspected third case; it was affected too.
Fix
All three anchored popovers now carry
role="dialog"and an accessible name — the formatted date, the event title (falling back to a localized "Event details"), and "New event".Quick-info also moves focus to its close control on open and hands it back to the chip on close. Quick-create already focused its title field.
The shared part
The focus entry/restore logic moves out of
MonthMorePopoverintouseAnchoredPanelFocus, now used by two call sites. It hinges on readingdocument.activeElementbefore the DOM patch, while the panel still exists — a tick later the node is gone, "is focus inside?" is false for every close, and focus gets yanked back even when the user deliberately moved on. That is the detail a second hand-written copy loses, and there is a test for it.VcPopovernow exposespanelElalongsideclose(). A call site managing focus needs the teleported panel to answer "is focus still inside?", and cannot reach it any other way.Dialog semantics stay opt-in props on
VcPopover, as #304 intended — this is three call sites opting in, not a change of default.Docs
The scheduler's accessibility section still said the overflow popover does not apply
role="dialog", which stopped being true with #304. QA flagged that drift under VCST-5671; it is corrected here along with the new behaviour.Tests
useAnchoredPanelFocus: five cases, including mounting already-open (these panels usually do) and the "user moved focus out first" case that the pre-DOM-patch check exists for.The
VcPopoverstub in the quick-info tests had to grow apanelEl: the real component exposes one, and a stub without it would make the focus tests pass vacuously.Verification
vue-tscclean ·vitest run4119 passed, exit 0 ·lint:check, prettier,check:locales, madge anddocs:lintclean.Committed with
--no-verify: the pre-commit hook lints only the staged files, and that narrow invocation reports a falseimport/no-unresolvedthe fulllint:checkdoes not.Closes VCST-5802