You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2582a33
Browse filesBrowse the repository at this point in the historyBrowse files
feat(Popover): presentation — a BottomSheet on a phone when asked, as iOS presents a popover
Popover takes `presentation` with the values DropdownMenu, ContextMenu,
MoreMenu, Selector and MultiSelector use. 'popover', the default, keeps the
released anchored surface. 'bottom-sheet' presents the content in a modal
BottomSheet labeled by `label`, at the sheet's tall height, inset by
`padding`. 'adaptive' presents that sheet on a compact touch screen and the
anchored popover elsewhere, which is how iOS presents a popover on an iPhone
unless the app keeps it anchored.
In a sheet, placement, alignment and width do not apply; light dismiss maps
to the sheet's purpose (info, form without light dismiss, required with
neither). The surface is chosen when the popover opens and stays until it
closes; the trigger's expanded state and controlled element follow it. The
sheet loads on demand (lazyPopoverBottomSheet), as DropdownMenu's does.
component:Popover gains the Presentation concept and DEC-6, pending owner
review, and OQ1 asks whether 'adaptive' becomes the default.
[feature] Popover takes `presentation`, with the values DropdownMenu and Selector use: `'popover'` (the default, unchanged) anchors it to its trigger, `'bottom-sheet'` presents its content in a modal BottomSheet labeled by `label`, and `'adaptive'` uses the BottomSheet on a compact touch screen (a phone) and the anchored popover elsewhere, the way iOS presents a popover on an iPhone. In a sheet, `placement`, `alignment` and `width` do not apply. The sheet loads only when a popover can present one.
Copy file name to clipboardExpand all lines: apps/storybook/stories/Popover.stories.tsx
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -863,6 +863,31 @@ export const BottomSheetPresentationOption: Story = {
863
863
},
864
864
};
865
865
866
+
exportconstAdaptivePresentation: Story={
867
+
name: 'Adaptive Presentation',
868
+
parameters: {
869
+
layout: 'fullscreen',
870
+
docs: {
871
+
story: {inline: false,height: '844px'},
872
+
description: {
873
+
story:
874
+
'presentation="adaptive": on a compact touch screen (a phone) the content is presented in a BottomSheet, the way iOS presents a popover on an iPhone; with a mouse or on a larger screen it stays anchored to its trigger.',
Copy file name to clipboardExpand all lines: packages/core/src/Popover/Popover.doc.mjs
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,13 @@ export const docs = {
149
149
'Whether pressing Escape dismisses the popover. Only takes full effect together with hasLightDismiss={false}, since native light dismiss also closes on Escape.',
150
150
default: 'true',
151
151
},
152
+
{
153
+
name: 'presentation',
154
+
type: "'popover' | 'bottom-sheet' | 'adaptive'",
155
+
description:
156
+
"The surface that holds the content. 'popover' anchors it to the trigger, 'bottom-sheet' presents it in a modal BottomSheet labeled by label, and 'adaptive' uses the BottomSheet on a compact touch screen (a phone) and the anchored popover elsewhere. In a sheet, placement, alignment and width do not apply.",
@@ -124,6 +125,7 @@ surface, not the Layer entry point. There is no installable
124
125
| Surface padding | A spacing-scale step, `0` through `10`| Sets the inset the painted surface keeps around caller content; `0` is a flush surface for content that owns its own edges | Popover and hook | Popover: step 3; hook: none |`component:Popover`| Pending owner review (DEC-4) | The rung lands on the painted surface, so a theme's `padding` on the `popover` target replaces it rather than nesting; consumer `xstyle` merges after it. |
125
126
| Surface target ownership | Shared baseline or component-specific refinement | Assigns `popover` as the broad surface owner and lets a composed component add its own target on that same element | Popover and hook |`popover` baseline; no component-specific refinement |`component:Popover`; the composed component owns its refinement target | Current compatibility contract |`popover-surface` is compatibility output, not a new target for consumers or a second anatomy owner. |
126
127
| Placement and preferred size | Logical placement/alignment plus preferred width | Positions the anchor surface and states the size Popover prefers; the layer runtime fits it to the viewport | Popover and hook renderer | Below/start; Popover matches trigger minimum width when no width is supplied |`component:Popover` for the preference; `architecture:layer-runtime` for the fit | Current public behavior | An explicit width renders at its size up to the viewport minus gutters; it is never shrunk to the room beside the trigger (`spec:AST-059` FR2). |
128
+
| Presentation |`popover`, `bottom-sheet`, or `adaptive`| Chooses the surface that holds the content: anchored, a BottomSheet, or a BottomSheet on a compact touch screen | Popover |`popover`|`component:Popover`; `component:BottomSheet` owns the sheet | Pending owner review (DEC-6) | In a sheet, placement, alignment and width do not apply; the surface is chosen when it opens and stays until it closes. |
127
129
128
130
### Public `usePopover` semantic inputs
129
131
@@ -331,6 +333,7 @@ consumers that need distinct theme reachability provide and document an owned
331
333
| FR5 |`Popover.test.tsx` scheduling and observer-lifecycle suites | Closed, opened, repeated signals, cleanup | Constructing observers while closed or measuring more than once per pending frame fails lifecycle assertions. |`audit:Popover/resources`|
332
334
| FR6, FR7 and theming anatomy |`Popover.test.tsx`, `Popover.doc.mjs`, `usePopover.doc.mjs`, `astryx theme targets Popover --json`, and `scripts/check-knowledge.mjs`| One real surface with canonical `popover` plus composed-component refinements | A fake anatomy part, missing canonical output, or an active target without a real owner fails review or validation. |`audit:Popover/theming`|
333
335
| AR5 |`Popover.stories.tsx` manual-AT fixture and PR #5373 test record | Read-only dialog manual-AT fixture; no recorded NVDA/VoiceOver announcement result | A fixture without recorded AT/browser observations cannot be cited as announcement proof. |`audit:Popover/at-evidence`|
336
+
| Presentation (DEC-6) |`PopoverPresentation.test.tsx`| Default on a phone, adaptive on a phone and a desktop, forced sheet, close, controlled, dismissal mapping | A sheet on a default phone popover, an anchored popover where the sheet is asked for, or a trigger state that ignores the sheet fails. |`audit:Popover/api`|
334
337
335
338
## Decision log
336
339
@@ -391,6 +394,29 @@ Rejected: moving focus to the dialog surface on every pointer opening solely to
391
394
avoid a keyboard-looking outline. That mixes visual modality with semantic focus
392
395
placement and bypasses the shared focus-indication owner.
393
396
397
+
### DEC-6 — Presentation: the anchored popover, a sheet, or adaptive
398
+
399
+
**Reference:**`component:Popover/DEC-6`
400
+
401
+
**Decider:** pending owner review
402
+
403
+
Popover takes `presentation` with the vocabulary DropdownMenu, ContextMenu,
404
+
MoreMenu, Selector and MultiSelector already use (`popover | bottom-sheet |
405
+
adaptive`). `popover`, the default and the released behavior, anchors the
406
+
surface to the trigger. `bottom-sheet` presents the content in a modal
407
+
BottomSheet labeled by Popover's `label`, at the sheet's tall height and inset
408
+
by Popover's `padding`. `adaptive` presents that sheet on a compact touch
409
+
screen (the shared compact-touch query) and the anchored popover elsewhere,
410
+
which is how iOS presents a popover on an iPhone unless the app keeps it: a
411
+
sheet the height of the screen below the status bar.
412
+
413
+
In a sheet, `placement`, `alignment` and `width` do not apply, and dismissal
414
+
maps to the sheet's purpose: `info` with light dismiss, `form` without it
415
+
(Escape still closes), `required` with neither. The surface is chosen when the
416
+
popover opens and stays until it closes, and the trigger's expanded state and
417
+
controlled element follow whichever surface is open. The sheet loads on
418
+
demand, so pages whose popovers stay anchored do not load it.
419
+
394
420
## Verification gaps
395
421
396
422
These implementation and evidence items remain required follow-up, but they do
@@ -408,9 +434,14 @@ not block acceptance of the semantic contract above.
408
434
409
435
## Open questions
410
436
411
-
None. DEC-1 settles the visibility model, DEC-2 settles canonical target
412
-
ownership, and DEC-3 settles semantic focus versus modality-aware indication.
413
-
The remaining items are verification work, not human API questions.
437
+
DEC-1 settles the visibility model, DEC-2 settles canonical target ownership,
438
+
and DEC-3 settles semantic focus versus modality-aware indication.
439
+
440
+
-**OQ1 — Default presentation.** iOS adapts a popover to a sheet on a phone
441
+
unless the app keeps it anchored; Popover keeps `popover` as its default
442
+
(DEC-6), so a phone shows the anchored popover unless the caller asks for
443
+
`adaptive`. Whether `adaptive` becomes the default is the owner's decision:
0 commit comments