Skip to content

Commit 8b28839

Browse files
vjeuxcixzhang
andauthored
chore(core): split long comment sentences in some menu press sources and tests (#9954)
* chore(core): split long comment sentences in some menu press sources and tests Splits the long comment sentences in the DropdownMenu finger hand-off and lit-row sources and tests, and drops "as before" from DropdownMenu's presentation JSDoc. Comments only; no code changes. * Merge branch 'main' into uikit/c19-menu-press-comments Co-authored-by: Cindy Zhang <cindyxz@meta.com>
1 parent 8daca93 commit 8b28839

7 files changed

Lines changed: 45 additions & 36 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+
[docs] Long comment sentences in some menu press sources and tests are split into shorter ones, and DropdownMenu's `presentation` description no longer says "as before". Nothing a consumer imports or renders changes.
6+
7+
@vjeux

‎packages/core/src/DropdownMenu/DropdownMenu.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
463463
* Omitted, the menu is the anchored popover. Under a finger, on every
464464
* device, the finger that opened it picks as UIMenu's does, once it has
465465
* moved. `'popover'` pins the anchored popover with the pointer behavior on
466-
* every device (the opening press follows the settle rule, as before).
466+
* every device (the opening press follows the settle rule).
467467
*/
468468
presentation?: DropdownMenuPresentation;
469469
items: DropdownMenuOption[];
@@ -473,7 +473,7 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
473473
interface DropdownMenuCompoundProps extends DropdownMenuBaseProps {
474474
/**
475475
* `'popover'` pins the pointer behavior on every device (the opening press
476-
* follows the settle rule, as before). Omitted, on every device, the finger
476+
* follows the settle rule). Omitted, on every device, the finger
477477
* that opened the menu picks as UIMenu's does, once it has moved.
478478
*/
479479
presentation?: 'popover';

‎packages/core/src/DropdownMenu/__tests__/DropdownMenuDragHighlight.interaction.browser.spec.ts‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* profile, with real finger, pen and mouse input (touch.ts, webInput.ts and
77
* Playwright's mouse)
88
* @output Interaction proofs that the highlight follows a held pointer
9-
* (`spec:AST-094` FR27, FR43): dragged from the trigger across the rows,
10-
* each enabled row lights in turn and nothing is lit once the pointer
11-
* leaves the menu. Under a finger or a pen, the lit row is painted
12-
* stronger than a row the keyboard focuses. Under a mouse, it keeps that
13-
* hover tint. Under a desktop mouse, a press that begins on one row and
14-
* drags onto another leaves the row under it told apart from the first.
15-
* Under a desktop pen, only the row under it keeps the pressed overlay
9+
* (`spec:AST-094` FR27, FR43). Dragged from the trigger across the rows,
10+
* each enabled row lights in turn. Nothing is lit once the pointer leaves
11+
* the menu. Under a finger or a pen, the lit row is painted stronger than
12+
* a row the keyboard focuses. Under a mouse, it keeps that hover tint.
13+
* Under a desktop mouse, a press that begins on one row and drags onto
14+
* another leaves the row under it told apart from the first. Under a
15+
* desktop pen, only the row under it keeps the pressed overlay.
1616
* @position Evidence for the lit row's paint in DropdownMenu's rows; the
1717
* press model's mark on that row is unit-tested in useMenuPress.test.tsx
1818
*/
@@ -73,9 +73,9 @@ async function paintOf(row: Locator): Promise<string> {
7373
}
7474

7575
/**
76-
* The story with the open menu measured once its entrance has come to rest:
77-
* a tap opens it, the keyboard focuses its first row for the paint a
78-
* keyboard focus gets, and Escape closes it again.
76+
* The story with the open menu, measured once its entrance has come to rest.
77+
* A tap opens the menu, and the keyboard focuses its first row for the paint
78+
* a keyboard focus gets. Escape then closes it again.
7979
*/
8080
async function openLayout(page: Page): Promise<Layout> {
8181
await openStory(page, storybook(), 'core-dropdownmenu--default');
@@ -209,7 +209,7 @@ test('a held finger dragged from the trigger across the rows lights each enabled
209209
await recordFrames(page);
210210
const start = {x: layout.x, y: Math.floor(layout.triggerBottom) - 1};
211211
const endY = Math.ceil(layout.menuBottom) + 40;
212-
// The finger holds until the menu has opened under it, then slides down
212+
// The finger holds until the menu has opened under it. Then it slides down
213213
// across every row and off the menu, and rests there before the lift.
214214
await driver.play(
215215
path(

‎packages/core/src/DropdownMenu/__tests__/DropdownMenuTouchHandoff.interaction.browser.spec.ts‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
/**
44
* @file DropdownMenuTouchHandoff.interaction.browser.spec.ts
55
* @input The built Default DropdownMenu story under the harness's phone
6-
* profile, real touch input (Chromium CDP / WebKit's input command), and
7-
* UIMenu's handoff distance from the UIKit constants table
6+
* profile, with real touch input (Chromium CDP / WebKit's input command).
7+
* UIMenu's handoff distance comes from the UIKit constants table.
88
* @output Interaction proofs for the finger that opened DropdownMenu from its
9-
* trigger (`spec:AST-094` FR29): once the menu is open under the held
10-
* finger, a move shorter than the handoff onto a row and a lift act on
11-
* nothing and leave the menu open, however long the finger rested; a
12-
* finger that travels past it picks the row it lifts on, once
9+
* trigger (`spec:AST-094` FR29). Once the menu is open under the held
10+
* finger, a move shorter than the handoff onto a row, and a lift, act on
11+
* nothing. The menu stays open, however long the finger rested. A finger
12+
* that travels past the handoff picks the row it lifts on, once.
1313
* @position Evidence for the handoff in DropdownMenu (and MoreMenu, which
1414
* renders it); the machine itself is unit-tested in menuPressGesture.test.ts
1515
* and useMenuPress.test.tsx
@@ -77,8 +77,8 @@ interface Layout {
7777

7878
/**
7979
* The story under a finger, with the open menu's rows measured once its
80-
* entrance has come to rest: a tap opens it (its lift's click), Escape
81-
* closes it again.
80+
* entrance has come to rest. A tap opens the menu (its lift's click), and
81+
* Escape closes it again.
8282
*/
8383
async function openLayout(page: Page): Promise<Layout> {
8484
await openStory(page, storybook(), 'core-dropdownmenu--default');
@@ -111,9 +111,9 @@ test('a move shorter than the handoff onto a row, after the menu opened under th
111111
throw new Error('no Edit row');
112112
}
113113
// The finger rests on the trigger's edge nearest the menu until the menu
114-
// is open and the press has long settled, then moves 1 px (the first
115-
// sample the menu sees, where the distance counts from) and on, short of
116-
// the handoff, onto the first row.
114+
// is open and the press has long settled. Then it moves 1 px: the first
115+
// sample the menu sees, where the distance counts from. It goes on, short
116+
// of the handoff, onto the first row.
117117
const start = {x: layout.x, y: Math.floor(layout.triggerBottom) - 1};
118118
const origin = {x: layout.x, y: start.y + 1};
119119
const end = {x: layout.x, y: Math.ceil(edit.top) + 1};

‎packages/core/src/hooks/menuPressGesture.test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe('menuPressStep — the trigger', () => {
256256
});
257257

258258
describe('menuPressStep — a finger that opened the menu hands off after travelling (UIMenu)', () => {
259-
// UIKit on iOS 26.2: the menu opens under a held finger; the finger picks
259+
// UIKit on iOS 26.2: the menu opens under a held finger. The finger picks
260260
// only once it has moved the handoff distance from the first sample the
261261
// menu saw. Positions are viewport px.
262262
const held = (pointerType: 'touch' | 'pen' = 'touch') =>
@@ -319,9 +319,10 @@ describe('menuPressStep — a finger that opened the menu hands off after travel
319319
});
320320

321321
it('counts from the first sample, not from where the finger was when the menu opened (b4 capture: 7.3 pt, then 11 pt)', () => {
322-
// The finger rested at y 182 when the menu opened; samples then came at
323-
// 189.33, 196.67 (14.7 from the open point, 7.3 from the first sample)
324-
// and 200.33 (11 from the first sample), where UIKit began.
322+
// The finger rested at y 182 when the menu opened. Samples then came at
323+
// 189.33, 196.67 and 200.33, where UIKit began. The second sample is 14.7
324+
// from the open point and 7.3 from the first sample. The third is 11 from
325+
// the first sample.
325326
const samples = [189.33, 196.67, 200.33];
326327
const phases = samples.map(
327328
(_, i) =>

‎packages/core/src/hooks/menuPressGesture.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ export type MenuPressEffect<T> =
437437
| {type: 'clear'}
438438
| {type: 'act'; row: T}
439439
/**
440-
* The gesture ended without a row acting. `stray` says whether the browser
441-
* will still report a `click` for this gesture that must not act; `dismiss`
442-
* says the menu should close (a mouse released outside it).
440+
* The gesture ends without a row acting. Its `stray` flag is true when the
441+
* browser still sends a `click` for this gesture. That click must not act.
442+
* Its `dismiss` flag is true when the menu must close (a mouse released
443+
* outside it).
443444
*/
444445
| {type: 'settle'; stray: boolean; dismiss: boolean};
445446

‎packages/core/src/privateAttributes/menuPressLit.stylex.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
/**
33
* @file privateAttributes/menuPressLit.stylex.ts
44
* @input The row that a held finger or pen lights in a menu
5-
* @output markMenuPressLit and clearMenuPressLit, which mark that row,
6-
* isMenuPressLit, which reads the mark, menuPressLitRowStyle, which
7-
* paints the marked row, holdMenuPressPaint and releaseMenuPressPaint,
8-
* which keep the other rows off their pressed paint, and
9-
* isMenuPressPaintHeld, which reads that hold
5+
* @output Exports markMenuPressLit and clearMenuPressLit, which mark that row,
6+
* and isMenuPressLit, which reads the mark. It also exports
7+
* menuPressLitRowStyle, which paints the marked row. The hold pair,
8+
* holdMenuPressPaint and releaseMenuPressPaint, keeps the other rows off
9+
* their pressed paint, and isMenuPressPaintHeld reads that hold.
1010
* @position Owner module of the private menu-press-lit attribute: the only
1111
* file that writes its name. The menu press model (hooks/useMenuPress.ts)
1212
* marks the row; DropdownMenu's rows compose the styles. No package entry

0 commit comments

Comments
 (0)