Repository navigation
fix(layer): a press on another trigger of an open layer opens it there - #11337
Conversation
A close the browser starts itself is now recorded at its beforetoggle, so a show from the press's click is a new open that the popover-operations ledger replays after the hide. The dismissal remembers the trigger the layer was open for, and only a same-gesture show from that trigger is absorbed. Schedule's press-capture workarounds are removed; the month view keeps one narrow case, a press on "+N more" while its handed event is open, which shows the day's list again.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec ea93fde |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| Field | 59.3 kB (+158 B) · 7.3 kB CSS (0) | — | — · — · — |
| RadioList | 60.6 kB (+158 B) · 7.3 kB CSS (0) | — | — · — · — |
115 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| InputGroup | 60.9 kB (+154 B) · 7.9 kB CSS (0) | — | — · — · — |
| SegmentedControl | 101.9 kB (+147 B) · 6.9 kB CSS (0) | — | — · — · — |
| lab/Comments | 367.1 kB (+146 B) · 2.5 kB CSS (0) | — | — · — · — |
| TextArea | 66.7 kB (+145 B) · 9.4 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 360.1 kB (+145 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 92.3 kB (+140 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 91.8 kB (+137 B) · 751 B CSS (0) | — | — · — · — |
| lab/Schedule · Storybook | 111.4 kB (+137 B) · 3.9 kB CSS (0) | 4,753 (−44) | — · ✓ · ✓ |
| SideNav | 119.7 kB (+135 B) · 11.7 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 158.2 kB (+134 B) · 1.9 kB CSS (0) | — | — · — · — |
| CheckboxList | 72.9 kB (+133 B) · 7.8 kB CSS (0) | — | — · — · — |
| MobileNav | 74.9 kB (+133 B) · 11.0 kB CSS (0) | — | — · — · — |
| ChatComposer | 83.9 kB (+132 B) · 12.4 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 75.6 kB (+132 B) · 11.7 kB CSS (0) | — | — · — · — |
| FileInput | 73.5 kB (+132 B) · 11.3 kB CSS (0) | — | — · — · — |
| AlertDialog | 110.6 kB (+131 B) · 15.0 kB CSS (0) | — | — · — · — |
| Lightbox | 145.3 kB (+131 B) · 11.5 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 112.1 kB (+129 B) · 773 B CSS (0) | — | — · — · — |
| ChatLayout | 87.7 kB (+128 B) · 10.9 kB CSS (0) | — | — · — · — |
| DateRangeInput | 98.6 kB (+128 B) · 12.9 kB CSS (0) | — | — · — · — |
| NumberInput | 76.9 kB (+128 B) · 11.8 kB CSS (0) | — | — · — · — |
| Pagination | 117.7 kB (+128 B) · 18.2 kB CSS (0) | — | — · — · — |
| Tokenizer | 103.1 kB (+128 B) · 19.5 kB CSS (0) | — | — · — · — |
| TopNav | 76.6 kB (+128 B) · 11.3 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 115.9 kB (+128 B) · 1.4 kB CSS (0) | — | — · — · — |
| DropdownMenu | 103.6 kB (+127 B) · 17.9 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 64.8 kB (+127 B) · 10.3 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 113.3 kB (+127 B) · 1.1 kB CSS (0) | — | — · — · — |
| SideNavItem | 76.3 kB (+126 B) · 11.5 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.0 kB (+125 B) · 10.5 kB CSS (0) | — | — · — · — |
| Thumbnail | 68.8 kB (+125 B) · 11.9 kB CSS (0) | — | — · — · — |
| Toolbar | 47.0 kB (+125 B) · 8.1 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 91.0 kB (+124 B) · 12.5 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 81.6 kB (+123 B) · 11.7 kB CSS (0) | — | — · — · — |
| MultiSelector | 100.7 kB (+123 B) · 17.2 kB CSS (0) | — | — · — · — |
| Stepper | 66.1 kB (+123 B) · 10.5 kB CSS (0) | — | — · — · — |
| TableCell | 115.6 kB (+123 B) · 18.3 kB CSS (0) | — | — · — · — |
| Toast | 102.7 kB (+123 B) · 10.6 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 81.6 kB (+122 B) · 11.7 kB CSS (0) | — | — · — · — |
| ListItem | 74.7 kB (+122 B) · 11.7 kB CSS (0) | — | — · — · — |
| Tooltip | 31.9 kB (+121 B) · 4.5 kB CSS (0) | — | — · — · — |
| Link | 56.1 kB (+120 B) · 7.1 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 65.3 kB (+120 B) · 10.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 115.2 kB (+120 B) · 18.0 kB CSS (0) | — | — · — · — |
| Banner | 66.4 kB (+119 B) · 10.9 kB CSS (0) | — | — · — · — |
| InfoTip | 50.2 kB (+119 B) · 5.4 kB CSS (0) | — | — · — · — |
| Selector | 106.6 kB (+119 B) · 17.9 kB CSS (0) | — | — · — · — |
| StatusDot | 33.6 kB (+119 B) · 5.4 kB CSS (0) | — | — · — · — |
| Markdown | 195.2 kB (+118 B) · 21.1 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 68.6 kB (+118 B) · 162 B CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 303.7 kB (+118 B) · 2.6 kB CSS (0) | — | — · — · — |
| TopNavHeading | 81.5 kB (+117 B) · 11.6 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 281.4 kB (+117 B) · 2.3 kB CSS (0) | — | — · — · — |
| MoreMenu | 103.8 kB (+116 B) · 17.9 kB CSS (0) | — | — · — · — |
| Popover | 96.8 kB (+116 B) · 14.6 kB CSS (0) | — | — · — · — |
| Slider | 114.2 kB (+116 B) · 8.9 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 74.7 kB (+115 B) · 13.6 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 87.9 kB (+115 B) · 372 B CSS (0) | — | — · — · — |
| Calendar | 75.5 kB (+114 B) · 11.0 kB CSS (0) | — | — · — · — |
| ChatSendButton | 64.8 kB (+114 B) · 10.3 kB CSS (0) | — | — · — · — |
| CodeBlock | 79.7 kB (+114 B) · 11.6 kB CSS (0) | — | — · — · — |
| lab/TourStep | 92.4 kB (+114 B) · 691 B CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 286.3 kB (+114 B) · 454 B CSS (0) | — | — · — · — |
| charts/Chart | 211.5 kB (+113 B) · 516 B CSS (0) | — | — · — · — |
| DrawerHeader | 67.5 kB (+113 B) · 13.3 kB CSS (0) | — | — · — · — |
| IconButton | 64.5 kB (+113 B) · 10.3 kB CSS (0) | — | — · — · — |
| lab/TransferList | 107.1 kB (+113 B) · 1.2 kB CSS (0) | — | — · — · — |
| Carousel | 74.1 kB (+112 B) · 11.3 kB CSS (0) | — | — · — · — |
| DialogHeader | 67.3 kB (+112 B) · 11.9 kB CSS (0) | — | — · — · — |
| TextInput | 72.1 kB (+112 B) · 11.5 kB CSS (0) | — | — · — · — |
| lab/ListInput | 92.9 kB (+112 B) · 922 B CSS (0) | — | — · — · — |
| ComplexSelector | 76.9 kB (+111 B) · 12.2 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 74.3 kB (+111 B) · 10.1 kB CSS (0) | — | — · — · — |
| Table | 132.2 kB (+111 B) · 18.7 kB CSS (0) | — | — · — · — |
| DateInput | 196.1 kB (+110 B) · 17.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 71.9 kB (+110 B) · 10.4 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 65.0 kB (+109 B) · 10.4 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 77.7 kB (+108 B) · 11.3 kB CSS (0) | — | — · — · — |
| SideNavHeading | 81.8 kB (+108 B) · 11.7 kB CSS (0) | — | — · — · — |
| AppShell | 96.2 kB (+107 B) · 13.8 kB CSS (0) | — | — · — · — |
| AvatarGroup | 48.6 kB (+107 B) · 5.8 kB CSS (0) | — | — · — · — |
| CheckboxInput | 68.7 kB (+107 B) · 10.1 kB CSS (0) | — | — · — · — |
| ContextMenu | 114.3 kB (+107 B) · 17.8 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 51.8 kB (+106 B) · 5.7 kB CSS (0) | — | — · — · — |
| Button | 64.4 kB (+106 B) · 10.3 kB CSS (0) | — | — · — · — |
| TabList | 47.1 kB (+106 B) · 6.5 kB CSS (0) | — | — · — · — |
| Typeahead | 86.9 kB (+106 B) · 12.8 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 188.6 kB (+105 B) · 451 B CSS (0) | — | — · — · — |
| ToggleButton | 91.4 kB (+105 B) · 10.4 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 75.4 kB (+105 B) · 12.2 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.2 kB (+105 B) · 1.2 kB CSS (0) | — | — · — · — |
| DateTimeInput | 218.6 kB (+103 B) · 19.1 kB CSS (0) | — | — · — · — |
| Avatar | 45.8 kB (+101 B) · 5.7 kB CSS (0) | — | — · — · — |
| PowerSearch | 303.7 kB (+101 B) · 24.7 kB CSS (0) | — | — · — · — |
| TabMenu | 78.1 kB (+97 B) · 11.5 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 97.4 kB (+97 B) · 1.8 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.2 kB (+95 B) · 5.8 kB CSS (0) | — | — · — · — |
| TimeInput | 169.3 kB (+93 B) · 16.4 kB CSS (0) | — | — · — · — |
| HoverCard | 30.1 kB (+91 B) · 4.5 kB CSS (0) | — | — · — · — |
| TopNavMenu | 80.8 kB (+81 B) · 11.6 kB CSS (0) | — | — · — · — |
| Switch | 108.7 kB (+74 B) · 10.0 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 16.4 kB (+2 B) · 168 B CSS (0) | — | — · — · — |
| ChatToolCalls | 34.8 kB (+1 B) · 8.4 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 34.3 kB (+1 B) · 7.6 kB CSS (0) | — | — · — · — |
| ProgressBar | 12.0 kB (+1 B) · 6.4 kB CSS (0) | — | — · — · — |
| Timestamp | 35.8 kB (+1 B) · 10.6 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 54.8 kB (0) · 224 B CSS (0) | — | — · — · — |
| ChatMessageList | 30.6 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 75.9 kB (0) · 12.7 kB CSS (0) | — | — · — · — |
| Heading | 14.8 kB (0) · 5.5 kB CSS (0) | — | — · — · — |
| Spinner | 27.1 kB (0) · 6.3 kB CSS (0) | — | — · — · — |
| Timer | 16.3 kB (0) · 6.1 kB CSS (0) | — | — · — · — |
| Text | 14.2 kB (−1 B) · 5.5 kB CSS (0) | — | — · — · — |
| layer | — | — | — · ✓ · — |
| Layer | — | — | ✓ · ✓ · — |
Package size: @astryxdesign/core 7.48 MB packed (+704 B); no new dependencies.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes are needed, and approval also waits on a spec decision: this pull request deliberately narrows architecture:layer-runtime INV7 (today, the same press that closes a layer cannot immediately reopen it) and records a close the browser starts at beforetoggle instead of the queued toggle. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner.
Blocking
- A controlled
PopoverwhoseisOpenanother control toggles now ends hidden with its statetruewhen that control is pressed while the popover is open, becauseonHideruns before the press's click and the click'sshow()is then absorbed (useLayer.tsxlines 2046-2047,Popover.tsxlines 1047-1048,useLayer.tsxlines 1561-1566), so keep reporting the close to callers attoggleunless a show from another trigger arrives first, and add a regression test. - Two description claims are wrong: the current layer-runtime record does state that browser-initiated closes are observed through the queued
toggleevent, andopenNowshows the same-gesture show at once (the ledger replays only a refused show), so correct both sentences and the matching comment atuseLayer.tsxlines 2036-2038.
The new unit tests and Chromium specs have not run on this head yet because CI skips drafts; smaller suggestions are inline.
Claims and files checked
- Claim: a press on another trigger of a shared layer opens it there. Verified in code and the new unit test.
- Claim: a press on the open trigger still closes the layer. Verified in code and the new unit test.
- Claim: for a close the browser starts,
onHideandisOpenarrive one task earlier. Verified; this also coverspopover="auto"eviction, which the changeset does not mention. - Claim: Schedule's week and day views drop their workaround, and the month view keeps one narrow case. Verified in the diff.
- Claim: before this change the close was recorded only at
toggle, and every same-gesture show was absorbed. Verified in the base code. - Claim: the operations ledger replays the same-gesture show after the hide. False for the switch, which shows at once.
- Claim: an engine without
beforetogglestill reports the close attoggle. Verified. - Claim: no documented contract promised the later timing. False; the record's lifecycle paragraph states it.
- Claim: single-fired close holds, with a new test. Verified in code.
- Claim: the new unit test fails before the change. Verified by reading both versions of the code.
- Claim: the listed suites, typecheck, lint and knowledge checks pass. Not verified; CI did not run on this draft.
- File
.changeset/layer-browser-close-other-trigger.md: clear. - File
docs/architecture/layer-runtime.md: waits on the spec decision. - File
packages/core/src/Layer/useLayer.tsx: blocking regression, plus inline suggestions. - File
packages/core/src/Layer/useLayer.test.tsx: clear. - File
packages/lab/src/Schedule/Schedule.test.tsx: clear. - File
packages/lab/src/Schedule/TimeGridView.tsx: clear, with one inline suggestion. - File
packages/lab/src/Schedule/useScheduleViewPopover.ts: clear. - File
packages/lab/src/Schedule/__tests__/ScheduleEventPopover.a11y.chromium.spec.ts: clear. - File
packages/lab/src/Schedule/__tests__/ScheduleMonthEventPopover.a11y.chromium.spec.ts: clear.
| // A press on another block while the popover is open opens it there; a | ||
| // press on the open block ends closed: the layer absorbs a show from the | ||
| // trigger its light dismiss closed it for. | ||
| if (isCurrent && popover.isOpen) { |
There was a problem hiding this comment.
Non-blocking: a press on the open block now gets past this check, because onHide already cleared openBlock at the light dismiss. It then sets openBlock (line 278) before the absorbed show(). The closed popover keeps that event's renderPopover content mounted until the next open. useScheduleViewPopover.ts:122 does the same with openKey. aria-expanded stays correct, because it also checks popover.isOpen.
… trigger moves the layer Reporting the close at beforetoggle let a separate control that toggles a controlled layer reopen it, and the show was absorbed: the layer ended hidden with its state open. The close is reported at toggle again, as before. beforetoggle only notes the hide and its trigger; a show from another trigger during that hide moves the layer there, and the old trigger's close is not reported. The changeset drops the timing note.
|
/approve-spec 76fd6ad |
…toggles A fixture for the device check: a controlled Popover with a separate button that opens and closes it.
|
/approve-spec e766f9a |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft, and it runs once the pull request is ready for review.
The narrowed architecture:layer-runtime INV7 and the new lifecycle sentence carry an engineering owner's approval for this head. The controlled-Popover regression from the earlier revision is fixed: the browser's close is reported at toggle again, with a regression test.
Non-blocking:
- Where the light dismiss is reported before the click, a press on the open Schedule event can leave its key set on the closed popover, so that event's
renderPopovercontent stays mounted while hidden (TimeGridView.tsx:279,useScheduleViewPopover.ts:122). - Two Schedule comments say the absorb is why a press on the open trigger closes, but in the usual order the click itself calls
hide();data-schedule-event-blockis now rendered with no reader.
Claims and files checked
- Claim: A press on another trigger of an open layer opens it there, with a mouse or a finger (verified: useLayer.tsx:1579-1590; new unit test (fails on the base by trace); Schedule Chromium finger case).
- Claim: A press on the open trigger still closes it (verified: TimeGridView.tsx:275-278, useScheduleViewPopover.ts:118-121; unit test).
- Claim: The browser's close is still reported at its toggle (verified: useLayer.tsx:2101-2111).
- Claim: When the layer moves, the old trigger's close is not reported and a controlled parent sees open A then open B (verified: useLayer.tsx:2097-2099; the unit test asserts the log).
- Claim: A separate control that toggles a controlled layer works as before (verified: unit test for a controlled layer; Popover.tsx:1037-1050 sync traced).
- Claim: Where the toggle lands before the click, only a same-gesture show from the dismissed trigger is absorbed (verified: useLayer.tsx:1570-1575, :1990).
- Claim: On the base the click's show did nothing during the hide, and every same-gesture show was absorbed (verified: base openNow).
- Claim: The week and day press capture is removed; the month view keeps only the "+N more" return, which the Schedule record intends (verified: TimeGridView.tsx diff, useScheduleViewPopover.ts:97-110, Schedule DEC-7).
- Claim: The record text quoted in the description matches the head record, and INV6 holds with a test (verified: layer-runtime.md:311-317, :537-541; single-fired close test).
- Claim: The new unit tests fail on the base or the previous revision (verified by trace; not run).
- Claim: The named suites (2,605 tests), typecheck, lint and the knowledge and changeset checks pass (not verified here: CI has not run on this head).
- Claim: Real Chrome probe results and the planned device check (author's stated evidence; consistent with the code for this revision).
- Claim: Changeset: a layer with several triggers opens at another trigger, with a mouse or a finger; a press on the open trigger still closes it (verified, as above).
- File:
.changeset/layer-browser-close-other-trigger.md: clear. - File:
apps/storybook/stories/Popover.stories.tsx: clear. - File:
docs/architecture/layer-runtime.md: clear (owner-approved). - File:
packages/core/src/Layer/useLayer.tsx: clear; one comment note. - File:
packages/core/src/Layer/useLayer.test.tsx: clear. - File:
packages/lab/src/Schedule/TimeGridView.tsx: non-blocking: stale open key, comment, dead attribute. - File:
packages/lab/src/Schedule/useScheduleViewPopover.ts: non-blocking: stale open key, comment. - File:
packages/lab/src/Schedule/Schedule.test.tsx: clear. - File:
packages/lab/src/Schedule/__tests__/ScheduleEventPopover.a11y.chromium.spec.ts: clear. - File:
packages/lab/src/Schedule/__tests__/ScheduleMonthEventPopover.a11y.chromium.spec.ts: clear.
| // A press on another block while the popover is open opens it there; a | ||
| // press on the open block ends closed: the layer absorbs a show from the | ||
| // trigger its light dismiss closed it for. |
There was a problem hiding this comment.
Non-blocking (INV29): in the usual order the click still sees the popover open and calls hide() below; the absorb applies only when the light dismiss is reported before the click. Suggested:
// A press on the open block closes the popover. If the light dismiss is
// reported before the click, the layer absorbs this show.| // A press on another trigger while the popover is open: the browser's | ||
| // light dismiss closes it as the press ends, and this show from the other | ||
| // trigger opens it there. A press on the open trigger ends closed: its | ||
| // light dismiss closes the popover, and the layer absorbs the show from | ||
| // that same trigger. |
There was a problem hiding this comment.
Non-blocking (INV29): the same reason as in TimeGridView.tsx. In the usual order the click sees the popover open and toggle calls hide(); the absorb applies only when the light dismiss is reported first. Suggested:
// A press on another trigger opens the popover there. A press on the open
// trigger closes it. If the light dismiss is reported before the click, the
// layer absorbs this show.| // A hide the browser has started on its own (light dismiss, popover="auto" | ||
| // stack eviction, an Escape its close watcher answers), from `beforetoggle` | ||
| // until its `toggle`, with the trigger the layer was open for. `moved` is | ||
| // set when a show from another trigger reopens the layer during that hide. |
There was a problem hiding this comment.
Non-blocking (INV29): this is one 33-word fragment. Suggested:
// A hide the browser started on its own, from `beforetoggle` until its
// `toggle`. It keeps the trigger the layer was open for. `moved` marks a
// show from another trigger during that hide.|
/approve-spec e766f9a |
# Conflicts: # docs/architecture/layer-runtime.md
|
/approve-spec 2c796b1 |
There was a problem hiding this comment.
Approved. Moving a shared layer to the pressed trigger in useLayer matches the narrowed layer-runtime INV7 and lifecycle text that an engineering owner approved for this head, and the new unit tests and Schedule Chromium specs pass in CI.
Nothing blocks. Two optional follow-ups: add a two-trigger test where the hide's toggle lands before the click, since no current test reaches the trigger check in openNow in that order; and the earlier notes on Schedule's stale open key, comment wording and the unused data-schedule-event-block attribute still apply.
Claims and files checked
- Before: a press on another trigger of an open layer lost its show, and Schedule carried its own press code: verified against the base
openNowand the removed Schedule handlers. - After: a press on another trigger opens the layer there with a mouse or a finger, and a press on the open trigger still closes it: verified by the new unit tests and the Schedule Chromium specs, which pass in CI.
- The week and day workaround is gone, and the month view keeps only the "+N more" return: verified in
TimeGridView.tsxanduseScheduleViewPopover.ts. - Cause: the click's show lands between the browser's
beforetoggleandtogglewhile the layer still counts as open, and toggle-first engines absorbed every show in the gesture: verified against the base code. - Mechanism: the hide and its trigger are noted at
beforetoggle, the close is still reported attoggle, a show from another trigger moves the layer without reporting the old close, and a separate control still toggles a controlled layer: verified in code and by the unit tests. - Toggle-first engines absorb only a same-gesture show from the dismissed trigger: verified in code; no test drives this order with two triggers.
- Record text for INV7, the lifecycle paragraph and the verification row matches the description, and INV6 keeps its test: verified.
- Red-first claims for the switch test and the controlled test: verified by reading the base and the earlier head.
- Suites, typecheck, lint and knowledge checks pass: verified by CI at this head.
- Real-Chrome probe and the planned device check: stated in the description and judged from that text.
- No new public API and no internal context in public text: verified.
- Changeset: verified against the same evidence as the After claim.
- Files: changeset, Popover story, layer-runtime record,
useLayer.tsx,useLayer.test.tsx,Schedule.test.tsx,TimeGridView.tsx, both Schedule Chromium specs anduseScheduleViewPopover.ts: all ten visited; findings only inuseLayer.tsx,TimeGridView.tsxanduseScheduleViewPopover.ts, all non-blocking.
|
/approve-spec 2c796b1 |
# Conflicts: # docs/architecture/layer-runtime.md # packages/core/src/Layer/useLayer.tsx
|
/approve-spec a420f92 |
There was a problem hiding this comment.
Approved pending CI: two Node test legs are still running on this head.
Moving a shared layer to the pressed trigger in useLayer matches the narrowed layer-runtime INV7 and lifecycle text that an engineering owner approved at this head, and the merge from main leaves that path intact. Two non-blocking follow-ups remain:
- A two-trigger test where the hide's
togglelands before the click would guard the trigger-scoped absorb (useLayer.tsx:1567-1570), which no test or browser run reaches today. - In that same order, a press on the open Schedule event leaves its key set on the closed popover (
TimeGridView.tsx:279,useScheduleViewPopover.ts:122).
Claims and files checked
- Changeset: a shared layer opens at another trigger when the press on that trigger closes it, by mouse or finger — verified (
useLayer.test.tsx:1905fails on main and passes here; two-trigger runs in Chromium and Firefox; finger switch in Schedule's Chromium spec). - Changeset: a press on the open trigger still closes it — verified (
useLayer.test.tsx:1931; Chromium runs). - Before this change, a press on another trigger lost the show and the layer ended closed — verified (main in Chromium and Firefox).
- Schedule carried press-capture code in its views — verified (handlers removed from
TimeGridView.tsxanduseScheduleViewPopover.ts). - The click's show found the layer still open and did nothing, then the hide's
toggleclosed it — verified (main'sopenNow; red-first test). - Where the
togglelands before the click, main absorbed every same-gesture show from any trigger — verified (main'sopenNow). - The hide and its trigger are noted at
beforetoggle, and the close is still reported attoggle— verified (useLayer.tsx:2080-2088,:2120-2131). - A show from another trigger during that hide moves the layer, and the parent sees open A then open B — verified (
useLayer.test.tsx:1905; browser log). - A press on the open trigger, or a separate control toggling a controlled layer, works as before — verified (
useLayer.test.tsx:1931,:1948, passing on main and here). - Where the
togglelands first, only a show from the dismissed trigger is absorbed — verified by code (useLayer.tsx:1567-1570); no test drives that order. - The week and day views drop the workaround; the month view keeps only the "+N more" return — verified (diff;
Schedule.test.tsx:1542; month Chromium spec). - The quoted INV7 and lifecycle text match the record — verified (
layer-runtime.md:310-314,:538-542). - INV6 holds, with a test for a browser close then
hide()in one task — verified (useLayer.test.tsx:1992). - The switch test fails on main, and the controlled-toggle test failed on the earlier head — verified (both reruns).
- The Schedule tests simulate the light dismiss, and the "+N more" test returns the day's list — verified (
Schedule.test.tsx:971,:1272,:1542). - The Chromium specs add the open-event press, finger switch and "+N more" return — verified (they pass in CI at this head).
- The named suites, typecheck, lint, knowledge and changeset checks pass — verified (the suites, Core and Lab typecheck, lint on the changed files, and both checks pass here).
- No new public API — verified (built surfaces of Core and the themes are unchanged).
- Public text carries no internal context — verified.
- Files:
.changeset/layer-browser-close-other-trigger.mdclear;apps/storybook/stories/Popover.stories.tsxclear;docs/architecture/layer-runtime.mdclear;packages/core/src/Layer/useLayer.test.tsxclear;packages/core/src/Layer/useLayer.tsxnote (toggle-first test gap, comment wording);packages/lab/src/Schedule/Schedule.test.tsxclear;packages/lab/src/Schedule/TimeGridView.tsxnote (stale key, comment wording, unused attribute);ScheduleEventPopover.a11y.chromium.spec.tsclear;ScheduleMonthEventPopover.a11y.chromium.spec.tsclear;packages/lab/src/Schedule/useScheduleViewPopover.tsnote (stale key, comment wording).
| if ( | ||
| wasJustDismissed() && | ||
| dismissedTriggerRef.current === triggerRef.current | ||
| ) { |
There was a problem hiding this comment.
Non-blocking: this trigger comparison matters only where the hide's toggle lands before the click, and no test drives that order with two triggers (the toggle-first tests under light dismiss vs. the trigger click use one). Chromium and Firefox both deliver the click first, so removing the comparison would still pass every test and browser run. Suggested test: dispatch the toggle to closed, click B and expect the layer open at B; repeat from A and expect it closed.
User impact
Problem and solution fit
useLayer:beforetoggle) and reports it a task later (toggle). The press's click lands in between.useLayerstill counted the layer as open, so a show from that click did nothing, and then the hide'stoggleclosed it.togglelands before the click,wasJustDismissed()absorbed every show in that gesture, from any trigger.Mechanism:
useLayernotes, atbeforetoggle, that the browser has started closing the layer and for which trigger. The close is still reported at the hide'stoggle, as today.togglechanges nothing.togglelands before the click, the dismissal remembers the trigger the layer was open for, and only a same-gesture show from that trigger is absorbed.Month view's narrow case: a busy day's "+N more" can hand an event to the same popover, which keeps "+N more" as its trigger. A press on "+N more" while that event is open shows the day's list again (the Schedule record's intended return). That press comes from the trigger the layer is open for, so the runtime correctly absorbs it; the month hook closes the popover ahead of the browser for that one case only (the pressed trigger is expanded but owns switched content).
Expected behavior and authority
architecture:layer-runtimeINV7, narrowed: "The press that closes a layer cannot reopen it from the trigger it was open for; a press on another trigger of the same layer may show it, anchored to that trigger: a show in the same gesture from another trigger moves the layer to that trigger."toggleevent" and adds: "A show from another trigger while such a close is in flight moves the layer to that trigger; that close is not reported."hide()in the same task.Smallest restoration
Layer/useLayer.tsx: notes a browser-started hide and its trigger atbeforetoggle; a show from another trigger during that hide moves the layer; the hide'stogglethen reports nothing; the dismissal remembers its trigger and absorbs only a same-gesture show from it.lab/Schedule/TimeGridView.tsx: removes the press-capture block and the remembered press.lab/Schedule/useScheduleViewPopover.ts: removes the remembered press and the general press-capture; keeps only the "+N more" return described above.useLayer.test.tsx,Schedule.test.tsx, and the two Schedule Chromium specs.docs/architecture/layer-runtime.md(lifecycle paragraph, INV7, verification row).[fix]Changeset.Evidence
main(with the workaround)useLayer.test.tsx):main;hide()in the same task firesonHideonce.Schedule.test.tsx: the week and month switch tests simulate the browser's light dismiss instead of the removed press capture; the "+N more" handoff test now also presses "+N more" again and gets the day's list back.ScheduleEventPopoveradds a press on the open event (mouse and finger) and a finger switch between events;ScheduleMonthEventPopoveradds the "+N more" return.tsc, eslint,check:knowledgeandcheck:changesetspass.Scope
Writing rubric results
architecture:layer-runtime's existing INV7 and lifecycle text; no new record.