Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

chore(core): split long comment sentences in some menu press sources and tests (#9954)

Christopher Chedeau8b2883998550
diff --git a/.changeset/menu-press-comment-sentences.md b/.changeset/menu-press-comment-sentences.md
new file mode 100644
index 0000000000..8f3c1cb9f5
--- /dev/null
+++ b/.changeset/menu-press-comment-sentences.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[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.
+
+@vjeux
diff --git a/packages/core/src/DropdownMenu/DropdownMenu.tsx b/packages/core/src/DropdownMenu/DropdownMenu.tsx
index c0c4ff0264..d1c36a7a37 100644
--- a/packages/core/src/DropdownMenu/DropdownMenu.tsx
+++ b/packages/core/src/DropdownMenu/DropdownMenu.tsx
@@ -463,7 +463,7 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
* Omitted, the menu is the anchored popover. Under a finger, on every
* device, the finger that opened it picks as UIMenu's does, once it has
* moved. `'popover'` pins the anchored popover with the pointer behavior on
- * every device (the opening press follows the settle rule, as before).
+ * every device (the opening press follows the settle rule).
*/
presentation?: DropdownMenuPresentation;
items: DropdownMenuOption[];
@@ -473,7 +473,7 @@ interface DropdownMenuDataProps extends DropdownMenuBaseProps {
interface DropdownMenuCompoundProps extends DropdownMenuBaseProps {
/**
* `'popover'` pins the pointer behavior on every device (the opening press
- * follows the settle rule, as before). Omitted, on every device, the finger
+ * follows the settle rule). Omitted, on every device, the finger
* that opened the menu picks as UIMenu's does, once it has moved.
*/
presentation?: 'popover';
diff --git a/packages/core/src/DropdownMenu/__tests__/DropdownMenuDragHighlight.interaction.browser.spec.ts b/packages/core/src/DropdownMenu/__tests__/DropdownMenuDragHighlight.interaction.browser.spec.ts
index 3b4158e7cc..7142bde6c8 100644
--- a/packages/core/src/DropdownMenu/__tests__/DropdownMenuDragHighlight.interaction.browser.spec.ts
+++ b/packages/core/src/DropdownMenu/__tests__/DropdownMenuDragHighlight.interaction.browser.spec.ts
@@ -6,13 +6,13 @@
* profile, with real finger, pen and mouse input (touch.ts, webInput.ts and
* Playwright's mouse)
* @output Interaction proofs that the highlight follows a held pointer
- * (`spec:AST-094` FR27, FR43): dragged from the trigger across the rows,
- * each enabled row lights in turn and nothing is lit once the pointer
- * leaves the menu. Under a finger or a pen, the lit row is painted
- * stronger than a row the keyboard focuses. Under a mouse, it keeps that
- * hover tint. Under a desktop mouse, a press that begins on one row and
- * drags onto another leaves the row under it told apart from the first.
- * Under a desktop pen, only the row under it keeps the pressed overlay
+ * (`spec:AST-094` FR27, FR43). Dragged from the trigger across the rows,
+ * each enabled row lights in turn. Nothing is lit once the pointer leaves
+ * the menu. Under a finger or a pen, the lit row is painted stronger than
+ * a row the keyboard focuses. Under a mouse, it keeps that hover tint.
+ * Under a desktop mouse, a press that begins on one row and drags onto
+ * another leaves the row under it told apart from the first. Under a
+ * desktop pen, only the row under it keeps the pressed overlay.
* @position Evidence for the lit row's paint in DropdownMenu's rows; the
* press model's mark on that row is unit-tested in useMenuPress.test.tsx
*/
@@ -73,9 +73,9 @@ async function paintOf(row: Locator): Promise<string> {
}
/**
- * The story with the open menu measured once its entrance has come to rest:
- * a tap opens it, the keyboard focuses its first row for the paint a
- * keyboard focus gets, and Escape closes it again.
+ * The story with the open menu, measured once its entrance has come to rest.
+ * A tap opens the menu, and the keyboard focuses its first row for the paint
+ * a keyboard focus gets. Escape then closes it again.
*/
async function openLayout(page: Page): Promise<Layout> {
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
await recordFrames(page);
const start = {x: layout.x, y: Math.floor(layout.triggerBottom) - 1};
const endY = Math.ceil(layout.menuBottom) + 40;
- // The finger holds until the menu has opened under it, then slides down
+ // The finger holds until the menu has opened under it. Then it slides down
// across every row and off the menu, and rests there before the lift.
await driver.play(
path(
diff --git a/packages/core/src/DropdownMenu/__tests__/DropdownMenuTouchHandoff.interaction.browser.spec.ts b/packages/core/src/DropdownMenu/__tests__/DropdownMenuTouchHandoff.interaction.browser.spec.ts
index d2e1f5a102..a1b5649fc9 100644
--- a/packages/core/src/DropdownMenu/__tests__/DropdownMenuTouchHandoff.interaction.browser.spec.ts
+++ b/packages/core/src/DropdownMenu/__tests__/DropdownMenuTouchHandoff.interaction.browser.spec.ts
@@ -3,13 +3,13 @@
/**
* @file DropdownMenuTouchHandoff.interaction.browser.spec.ts
* @input The built Default DropdownMenu story under the harness's phone
- * profile, real touch input (Chromium CDP / WebKit's input command), and
- * UIMenu's handoff distance from the UIKit constants table
+ * profile, with real touch input (Chromium CDP / WebKit's input command).
+ * UIMenu's handoff distance comes from the UIKit constants table.
* @output Interaction proofs for the finger that opened DropdownMenu from its
- * trigger (`spec:AST-094` FR29): once the menu is open under the held
- * finger, a move shorter than the handoff onto a row and a lift act on
- * nothing and leave the menu open, however long the finger rested; a
- * finger that travels past it picks the row it lifts on, once
+ * trigger (`spec:AST-094` FR29). Once the menu is open under the held
+ * finger, a move shorter than the handoff onto a row, and a lift, act on
+ * nothing. The menu stays open, however long the finger rested. A finger
+ * that travels past the handoff picks the row it lifts on, once.
* @position Evidence for the handoff in DropdownMenu (and MoreMenu, which
* renders it); the machine itself is unit-tested in menuPressGesture.test.ts
* and useMenuPress.test.tsx
@@ -77,8 +77,8 @@ interface Layout {
/**
* The story under a finger, with the open menu's rows measured once its
- * entrance has come to rest: a tap opens it (its lift's click), Escape
- * closes it again.
+ * entrance has come to rest. A tap opens the menu (its lift's click), and
+ * Escape closes it again.
*/
async function openLayout(page: Page): Promise<Layout> {
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
throw new Error('no Edit row');
}
// The finger rests on the trigger's edge nearest the menu until the menu
- // is open and the press has long settled, then moves 1 px (the first
- // sample the menu sees, where the distance counts from) and on, short of
- // the handoff, onto the first row.
+ // is open and the press has long settled. Then it moves 1 px: the first
+ // sample the menu sees, where the distance counts from. It goes on, short
+ // of the handoff, onto the first row.
const start = {x: layout.x, y: Math.floor(layout.triggerBottom) - 1};
const origin = {x: layout.x, y: start.y + 1};
const end = {x: layout.x, y: Math.ceil(edit.top) + 1};
diff --git a/packages/core/src/hooks/menuPressGesture.test.ts b/packages/core/src/hooks/menuPressGesture.test.ts
index 08ddc8923e..bd51680928 100644
--- a/packages/core/src/hooks/menuPressGesture.test.ts
+++ b/packages/core/src/hooks/menuPressGesture.test.ts
@@ -256,7 +256,7 @@ describe('menuPressStep — the trigger', () => {
});
describe('menuPressStep — a finger that opened the menu hands off after travelling (UIMenu)', () => {
- // UIKit on iOS 26.2: the menu opens under a held finger; the finger picks
+ // UIKit on iOS 26.2: the menu opens under a held finger. The finger picks
// only once it has moved the handoff distance from the first sample the
// menu saw. Positions are viewport px.
const held = (pointerType: 'touch' | 'pen' = 'touch') =>
@@ -319,9 +319,10 @@ describe('menuPressStep — a finger that opened the menu hands off after travel
});
it('counts from the first sample, not from where the finger was when the menu opened (b4 capture: 7.3 pt, then 11 pt)', () => {
- // The finger rested at y 182 when the menu opened; samples then came at
- // 189.33, 196.67 (14.7 from the open point, 7.3 from the first sample)
- // and 200.33 (11 from the first sample), where UIKit began.
+ // The finger rested at y 182 when the menu opened. Samples then came at
+ // 189.33, 196.67 and 200.33, where UIKit began. The second sample is 14.7
+ // from the open point and 7.3 from the first sample. The third is 11 from
+ // the first sample.
const samples = [189.33, 196.67, 200.33];
const phases = samples.map(
(_, i) =>
diff --git a/packages/core/src/hooks/menuPressGesture.ts b/packages/core/src/hooks/menuPressGesture.ts
index c707c1a673..ad1132a762 100644
--- a/packages/core/src/hooks/menuPressGesture.ts
+++ b/packages/core/src/hooks/menuPressGesture.ts
@@ -437,9 +437,10 @@ export type MenuPressEffect<T> =
| {type: 'clear'}
| {type: 'act'; row: T}
/**
- * The gesture ended without a row acting. `stray` says whether the browser
- * will still report a `click` for this gesture that must not act; `dismiss`
- * says the menu should close (a mouse released outside it).
+ * The gesture ends without a row acting. Its `stray` flag is true when the
+ * browser still sends a `click` for this gesture. That click must not act.
+ * Its `dismiss` flag is true when the menu must close (a mouse released
+ * outside it).
*/
| {type: 'settle'; stray: boolean; dismiss: boolean};
diff --git a/packages/core/src/privateAttributes/menuPressLit.stylex.ts b/packages/core/src/privateAttributes/menuPressLit.stylex.ts
index 7a502dee1b..2fa5535ffc 100644
--- a/packages/core/src/privateAttributes/menuPressLit.stylex.ts
+++ b/packages/core/src/privateAttributes/menuPressLit.stylex.ts
@@ -2,11 +2,11 @@
/**
* @file privateAttributes/menuPressLit.stylex.ts
* @input The row that a held finger or pen lights in a menu
- * @output markMenuPressLit and clearMenuPressLit, which mark that row,
- * isMenuPressLit, which reads the mark, menuPressLitRowStyle, which
- * paints the marked row, holdMenuPressPaint and releaseMenuPressPaint,
- * which keep the other rows off their pressed paint, and
- * isMenuPressPaintHeld, which reads that hold
+ * @output Exports markMenuPressLit and clearMenuPressLit, which mark that row,
+ * and isMenuPressLit, which reads the mark. It also exports
+ * menuPressLitRowStyle, which paints the marked row. The hold pair,
+ * holdMenuPressPaint and releaseMenuPressPaint, keeps the other rows off
+ * their pressed paint, and isMenuPressPaintHeld reads that hold.
* @position Owner module of the private menu-press-lit attribute: the only
* file that writes its name. The menu press model (hooks/useMenuPress.ts)
* marks the row; DropdownMenu's rows compose the styles. No package entry