Skip to content

Commit 5a6ed90

Browse files
authored
chore(Layer): name the gap a still mouse leaves, exactly (#10317)
* chore(Layer): name the gap a still mouse leaves, exactly The DropdownMenu and touch-presentation records now name the gap left after the still-mouse fix exactly: a mouse whose last move the page's input stream did not hear. The stream records the mouse only while something listens for pointer events. The input hold's constant for the opening is named for the half side it holds, so its comment goes. * docs(Layer): the still-mouse gap is where the stream has not heard it The input stream also records a mouse's press, so a mouse heard pressing in place gets the opening where it rests. The records' gap sentence now names a mouse the page's input stream has not heard where it now rests. * docs(Layer): say where the still-mouse opening is, and when it is set On a shield over the viewport, the opening is where the page last heard the mouse when the shield came up; a mouse's press on the shield does not move it. A non-modal Drawer's shield, over its panel alone, stops a mouse only if the page had heard none then. The records now say so. * docs(Layer): the still-mouse opening is re-read at each finger event A shield reads the last mouse point when it comes up, and again at each press or move of a finger or a pen. The touch-presentation record now says so.
1 parent 27aba94 commit 5a6ed90

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[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.
6+
7+
@vjeux

‎docs/specs/AST-094-touch-presentations/spec.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,13 @@ under a finger, and a mouse follows `module:DropdownMenu/useMenuPress` FR3 and
949949
(a touchscreen laptop), a finger's tap or drag during the entrance is not
950950
held. After a finger, the first press of a mouse that has not moved since
951951
passes the entering presentation's shield where the page last heard the
952-
mouse. A mouse that has sent no pointer event since the page loaded still
953-
lands on the shield, and its press does nothing. A move of the mouse lowers
954-
the shield first.
952+
mouse. The shield reads that point when it comes up, and again at each
953+
press or move of a finger or a pen. A shield over the viewport opens only
954+
at the point last read, and not at all if the page had heard no mouse by
955+
then. A still mouse resting anywhere else presses the shield, and its press
956+
does nothing. A non-modal Drawer shields only its panel, and that shield
957+
stops a mouse only if the page had heard none at the last read. A move of
958+
the mouse lowers the shield first.
955959
- BottomSheet, Toast, Lightbox, NavigationStack and keyboard dismissal: a
956960
drag that commits follows FR36–FR40.
957961
- `spec:AST-100` owns release velocity, which FR17 reads.

‎docs/specs/components/DropdownMenu/DropdownMenu.spec.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ component-local concepts; each keeps its released default.
143143
| 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 |
144144
| 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 |
145145
| 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 |
146-
| 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` |
146+
| 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` |
147147
| 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 |
148148

149149
### Allowed variation
@@ -376,9 +376,9 @@ than adding a DropdownMenu-owned heading target.
376376
leaves with the layer's own entrance and exit instead of growing out of and
377377
back into the Trigger button, and a pan that starts outside does not close
378378
it, against `spec:AST-094` FR31 and FR32.
379-
- **Still mouse after a finger (FR22).** Known gap: after a finger, a mouse
380-
that has sent no pointer event since the page loaded still presses the
381-
entering menu's shield, so its first press does nothing.
379+
- **Still mouse after a finger (FR22).** Known gap: after a finger, a still
380+
mouse's first press does nothing unless the mouse rests where the page last
381+
heard it when the entering menu's shield came up.
382382
- **Delegated Trigger Button gaps (FR3).** The Trigger button scales on a press
383383
under reduced motion and holds a fixed height, as `component:Button` records,
384384
against `design:reduced-motion` DR1 and `spec:AST-102` FR4.

‎packages/core/src/Layer/inputHold.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ function addShield(layer: Element, isFull: boolean): HTMLElement {
264264
return shield;
265265
}
266266

267-
/** Half the side of the opening a presentation's shield leaves the mouse. */
268-
const MOUSE_OPENING_PX = 2;
267+
const MOUSE_OPENING_HALF_SIDE_PX = 2;
269268

270269
/**
271270
* Leaves the mouse a way through a presentation's shield that takes hits.
@@ -296,10 +295,10 @@ function openToMouse(state: HeldLayer, doc: Document): void {
296295
shield.style.pointerEvents = 'none';
297296
return;
298297
}
299-
const left = point.x - MOUSE_OPENING_PX;
300-
const right = point.x + MOUSE_OPENING_PX;
301-
const top = point.y - MOUSE_OPENING_PX;
302-
const bottom = point.y + MOUSE_OPENING_PX;
298+
const left = point.x - MOUSE_OPENING_HALF_SIDE_PX;
299+
const right = point.x + MOUSE_OPENING_HALF_SIDE_PX;
300+
const top = point.y - MOUSE_OPENING_HALF_SIDE_PX;
301+
const bottom = point.y + MOUSE_OPENING_HALF_SIDE_PX;
303302
// The viewport, then the opening drawn the other way round. The nonzero
304303
// rule leaves the opening out, and a clipped-out area takes no hits.
305304
const outline = [

0 commit comments

Comments
 (0)