An open source design system that's fully customizable and agent ready
TypeScript
chore(Layer): name the gap a still mouse leaves, exactly (#10317)
Christopher Chedeau5a6ed906fb65
diff --git a/.changeset/input-hold-opening-half-side.md b/.changeset/input-hold-opening-half-side.mdnew file mode 100644index 0000000000..889d077281--- /dev/null+++ b/.changeset/input-hold-opening-half-side.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[chore] Internal: the input hold's constant for the mouse's opening is named for the half side it holds, and its comment goes. Apps see no change.++@vjeuxdiff --git a/docs/specs/AST-094-touch-presentations/spec.md b/docs/specs/AST-094-touch-presentations/spec.mdindex 42dfb83492..a08daae7ee 100644--- a/docs/specs/AST-094-touch-presentations/spec.md+++ b/docs/specs/AST-094-touch-presentations/spec.md@@ -949,9 +949,13 @@ under a finger, and a mouse follows `module:DropdownMenu/useMenuPress` FR3 and(a touchscreen laptop), a finger's tap or drag during the entrance is notheld. After a finger, the first press of a mouse that has not moved sincepasses the entering presentation's shield where the page last heard the- mouse. A mouse that has sent no pointer event since the page loaded still- lands on the shield, and its press does nothing. A move of the mouse lowers- the shield first.+ mouse. The shield reads that point when it comes up, and again at each+ press or move of a finger or a pen. A shield over the viewport opens only+ at the point last read, and not at all if the page had heard no mouse by+ then. A still mouse resting anywhere else presses the shield, and its press+ does nothing. A non-modal Drawer shields only its panel, and that shield+ stops a mouse only if the page had heard none at the last read. A move of+ the mouse lowers the shield first.- BottomSheet, Toast, Lightbox, NavigationStack and keyboard dismissal: adrag that commits follows FR36–FR40.- `spec:AST-100` owns release velocity, which FR17 reads.diff --git a/docs/specs/components/DropdownMenu/DropdownMenu.spec.md b/docs/specs/components/DropdownMenu/DropdownMenu.spec.mdindex 041720944b..40994a222a 100644--- a/docs/specs/components/DropdownMenu/DropdownMenu.spec.md+++ b/docs/specs/components/DropdownMenu/DropdownMenu.spec.md@@ -143,7 +143,7 @@ component-local concepts; each keeps its released default.| FR17 | A disabled menu row MUST be reached by the keyboard and stay inert (DEC-11): in DropdownMenu, its sub-menus, MoreMenu, ContextMenu and NavHeadingMenu, ArrowDown, ArrowUp, Home, End and type-ahead visit a disabled row as they visit any other row, the row takes focus and exposes `aria-disabled="true"`, and Enter, Space or a click on it does nothing and leaves the menu open. Opening a menu from the keyboard still lands on an enabled row: the first, or the last after ArrowUp on the trigger (FR12, AR4). Implementation gap: the arrow keys and type-ahead skip disabled rows today. | DEC-11; WAI-ARIA Menu pattern || FR20 | With `header` or `footer` on a sub-menu (`DropdownMenuSubMenu`), its surface is a modal dialog named by its row (AR7), holding the header, the sub-menu's `role="menu"` (rows only), then the footer. It sits in a host `DropdownMenu` renders beside its menu, never inside a menu; under a root with no such host (`ContextMenu`) the sub-menu shows its rows alone. On a fine pointer the dialog is the flyout; on a compact touch display, the drilled-in view, which replaces the root's menu and regions until popped. A region keeps its own keys and presses. The rows are one Tab stop: Tab and Shift+Tab walk the header's controls, the rows, then the footer's, and wrap; from a deeper flyout, that flyout closes and the walk goes on from the rows. An open lands as for any sub-menu (FR11, FR12), not on a region. Escape in the dialog, outside an IME composition and unless a control there handled it, returns focus to the row and leaves the root open. A pointer leaving the flyout keeps it open until focus leaves, and it closes with the flyout holding its row. Without either prop nothing changes. | Current behavior; FR15; AR5 || FR21 | Under a finger, in the touch modes (`presentation` not pinned to `'popover'`), the pointer menu MUST grow out of the Trigger button on the theme's entrance duration and easing tokens and collapse back into it on the theme's exit duration and easing (`spec:AST-094` FR7, FR31, FR45), and MUST close as a pan that starts outside it begins (FR32); a pinned `'popover'` keeps the layer's own entrance. A pan dismissal is the menu's own close: focus that was in the menu returns to the Trigger button, whose `aria-expanded` turns false. A mouse keeps the layer's own entrance and exit. Implementation gap: the menu keeps the layer's own entrance and exit under a finger too, and has no pan-outside dismissal of its own. | `spec:AST-094` FR31, FR32; `family:overlay-dismissal` AV6 |-| FR22 | Under a finger, in the touch modes, where the primary pointer is coarse (a phone or a tablet), a tap or a drag that lands while the pointer menu enters MUST reach nothing: it closes nothing, scrolls nothing, moves no focus and clicks nothing (`spec:AST-094` FR35). The finger that opened the menu still picks the row it lifts on (FR8). Keys and assistive technology stay live. A mouse, a pinned `'popover'` and a finger where the primary pointer is fine (a touchscreen laptop) hold nothing, as for `component:Drawer`. Implementation gap: after a finger, the first press of a mouse that has sent no pointer event since the page loaded lands on the entering menu's shield (`spec:AST-094` FR35). | `spec:AST-094` FR35; `architecture:layer-runtime` |+| FR22 | Under a finger, in the touch modes, where the primary pointer is coarse (a phone or a tablet), a tap or a drag that lands while the pointer menu enters MUST reach nothing: it closes nothing, scrolls nothing, moves no focus and clicks nothing (`spec:AST-094` FR35). The finger that opened the menu still picks the row it lifts on (FR8). Keys and assistive technology stay live. A mouse, a pinned `'popover'` and a finger where the primary pointer is fine (a touchscreen laptop) hold nothing, as for `component:Drawer`. Implementation gap: after a finger, a still mouse's first press lands on the entering menu's shield unless the mouse rests where the page last heard it when the shield came up (`spec:AST-094` FR35). | `spec:AST-094` FR35; `architecture:layer-runtime` || FR23 | Tab or Shift+Tab on a row at any level of a menu without `header` or `footer`, its own rows or an open sub-menu flyout's at any depth, closes every open level and the menu, calls `onOpenChange(false)` once, and leaves focus to move on from the trigger in page order (WAI-ARIA Menu Button). A level with a header or footer keeps FR15's and FR20's Tab cycle within it. | WAI-ARIA Menu Button pattern; current tests |### Allowed variation@@ -376,9 +376,9 @@ than adding a DropdownMenu-owned heading target.leaves with the layer's own entrance and exit instead of growing out of andback into the Trigger button, and a pan that starts outside does not closeit, against `spec:AST-094` FR31 and FR32.-- **Still mouse after a finger (FR22).** Known gap: after a finger, a mouse- that has sent no pointer event since the page loaded still presses the- entering menu's shield, so its first press does nothing.+- **Still mouse after a finger (FR22).** Known gap: after a finger, a still+ mouse's first press does nothing unless the mouse rests where the page last+ heard it when the entering menu's shield came up.- **Delegated Trigger Button gaps (FR3).** The Trigger button scales on a pressunder reduced motion and holds a fixed height, as `component:Button` records,against `design:reduced-motion` DR1 and `spec:AST-102` FR4.diff --git a/packages/core/src/Layer/inputHold.ts b/packages/core/src/Layer/inputHold.tsindex af212c9b76..eb5438beec 100644--- a/packages/core/src/Layer/inputHold.ts+++ b/packages/core/src/Layer/inputHold.ts@@ -264,8 +264,7 @@ function addShield(layer: Element, isFull: boolean): HTMLElement {return shield;}-/** Half the side of the opening a presentation's shield leaves the mouse. */-const MOUSE_OPENING_PX = 2;+const MOUSE_OPENING_HALF_SIDE_PX = 2;/*** Leaves the mouse a way through a presentation's shield that takes hits.@@ -296,10 +295,10 @@ function openToMouse(state: HeldLayer, doc: Document): void {shield.style.pointerEvents = 'none';return;}- const left = point.x - MOUSE_OPENING_PX;- const right = point.x + MOUSE_OPENING_PX;- const top = point.y - MOUSE_OPENING_PX;- const bottom = point.y + MOUSE_OPENING_PX;+ const left = point.x - MOUSE_OPENING_HALF_SIDE_PX;+ const right = point.x + MOUSE_OPENING_HALF_SIDE_PX;+ const top = point.y - MOUSE_OPENING_HALF_SIDE_PX;+ const bottom = point.y + MOUSE_OPENING_HALF_SIDE_PX;// The viewport, then the opening drawn the other way round. The nonzero// rule leaves the opening out, and a clipped-out area takes no hits.const outline = [