Skip to content

feat(NumberInput): a finger on a stepper no longer raises the keyboard - #8173

Closed
vjeux wants to merge 7 commits into
meta:mainfrom
vjeux:uikit/c04-stepper-focus
Closed

vjeux wants to merge 7 commits into
meta:mainfrom
vjeux:uikit/c04-stepper-focus

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review only this PR's change: vjeux/astryx@d07518f...877accf

User need

On a phone, every tap on a NumberInput's + or − focuses the text field, so the number pad slides up over the page and the value that just changed: the visible height drops from 714 to 404 px in iOS Safari.

What led to it: Astryx's touch-presentation work (spec:AST-094) matches its components to native iOS controls on phones. Comparing NumberInput with UIKit's stepper on the iOS simulator showed the gap: a native stepper never takes focus.

Design and alternatives

  • Focus on every press (today): the keyboard covers the page on every tap.
  • Never focus: after a mouse click the arrow keys and the wheel stop stepping, and a desktop screen reader hears nothing.
  • Chosen: decide by what pressed. A finger leaves focus where it was. A mouse focuses the field, as today. A pen or a screen reader focuses it on a desktop, so the new value is announced, but not on a phone, where focusing raises the keyboard. iOS's double-tap mouse event no longer takes focus off a field being edited.

Open for the owner: should a desktop pen focus like a mouse? Should a screen reader's press focus on a desktop but not on a phone (whether iOS VoiceOver reports a pointer is unmeasured)? Open #8015 hides the steppers on phones instead; this PR works with either.

Current specification

component:NumberInput FR5 ("focus stays on the input"), amended here; architecture:interaction-modality INV2 leaves the choice to the component.

Public delta and caller burden

No API change. onFocus no longer fires for a finger's stepper press: [feat] (patch), or [breaking] if the owner counts that as supported (spec:AST-017 FR1).

Testing

On a phone, open Storybook's NumberInput "With number steppers" story:

  1. Tap +. The value goes up by one; no keyboard appears.
  2. Tap the field, then +. The value goes up; the keyboard stays.
  3. Double-tap + while editing. The field keeps focus.

On a desktop, click +: the value goes up and the field takes focus, so the arrow keys step it. Unit tests and a Chromium test cover each input; the new ones fail on main.

Evidence

Recorded on the iOS 26.2 simulator and the Android emulator.

Android Chrome, main beside

Size (the PR size report's measure, gzip): NumberInput 55.6 → 56.1 KB, CSS unchanged.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

R1 narration, R2 research, R4 rejected alternatives, R5 change references, R6 open questions: none in the amended rows. R3 evidence: FR5 cites spec:AST-085 FR1–FR2, UIStepper never taking focus, and current tests.

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 26, 2026 10:43pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 30, 2026, 1:43 PM UTC

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

NumberInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 502B 502B 0B
Lines of Code 1144 1179 -
Complexity Very High Very High (177) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/NumberInput 55.6KB 56.1KB +475B 10.7KB 10.7KB 0B
core/Pagination 87.3KB 87.5KB +135B 15.2KB 15.2KB 0B
core/PowerSearch 147.7KB 147.9KB +203B 18.5KB 18.5KB 0B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.3KB 34.3KB 0B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 2 compared shot(s).


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to provide or identify the governing rule for where focus goes when a NumberInput stepper is pressed: no current Astryx record settles it, and this change makes touch, pen and no-pointer presses step the value without focusing the field while a mouse click still focuses it, alongside open #8015, which hides the steppers on coarse pointers instead. An engineering owner records that decision by commenting /approve-spec ae296ad0c19b0466ab28ac4cb23606bc677ffd53 on this pull request, and the author may do so as an engineering owner. The implementation itself matches its description for touch, pen, mouse and editing presses. Once the rule is settled, the changeset needs one fix: it mentions only a finger or a pen, but clicks with no pointer press (screen-reader activation, a programmatic click()) also stop focusing the field, so either name that path there or narrow the guard to touch and pen.

[Automated review]

'@astryxdesign/core': patch
---

[fix] NumberInput: a finger or a pen on a number stepper steps the value without focusing the field, so on a phone the on-screen keyboard no longer slides up over the page with every tap. A field that is already being edited stays focused, and a mouse click still focuses the field, so the arrow keys and the wheel keep stepping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This names a finger or a pen, but the guard in NumberInput.tsx (pointerType === 'mouse' && event.detail > 0) also stops focusing the field for clicks with no pointer press or detail 0, such as screen-reader activation or a programmatic click(). If that path stays after the owner's decision, name it here; otherwise narrow the guard to touch and pen.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named in d982db5: the changeset now covers a finger, a pen, and an activation with no pointer (a screen reader, a programmatic click()), as the guard and the no-pointer unit test do.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to settle where focus goes when a NumberInput stepper is pressed: no current Astryx record covers it, and this change makes touch, pen and no-pointer presses (screen-reader activation, a programmatic click()) step the value without focusing the field while a mouse click still focuses it, alongside open #8015, which hides the steppers on coarse pointers instead. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. The implementation, its tests and the Changeset match the described behavior, and the earlier Changeset gap about the no-pointer path is fixed, so nothing else is needed if the rule is approved as implemented; if the owner limits it to touch and pen, the guard, the no-pointer unit test and the Changeset need to follow.

[Automated review]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
A tap on a number stepper called focus() on the field, and on a phone a focus
during a tap brings up the on-screen keyboard: every tap on + slid the decimal
pad over the page (iOS 26.2 Safari, measured). UIStepper never becomes first
responder. A finger, a pen or assistive technology now steps the value and
leaves focus where it was; an editing field stays focused (the press is still
default-prevented); a mouse click still focuses the field so the arrow keys
and the wheel keep stepping.
@vjeux
vjeux force-pushed the uikit/c04-stepper-focus branch from d982db5 to 55d4531 Compare October 25, 2026 02:37
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to settle where focus goes when a NumberInput stepper is pressed: no current Astryx record covers it, and this change makes touch, pen and no-pointer presses (screen-reader activation, a programmatic click()) step the value without focusing the field while a mouse click still focuses it, alongside open #8015, which hides the steppers on coarse pointers instead. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. The implementation, its tests and the Changeset match the described behavior at this head, so nothing else is needed if the rule is approved as implemented; if the owner limits it to touch and pen, the guard, the no-pointer unit test and the Changeset need to follow.

[Automated review]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
ci.yml takes main's: main discovers every *.a11y.chromium.spec.ts
(meta#8367), so the NumberInput stepper-focus spec needs no step of its own.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to settle where focus goes when a NumberInput stepper is pressed: no current Astryx record covers it, and this change makes touch, pen and no-pointer presses (screen-reader activation, a programmatic click()) step the value without focusing the field while a mouse click still focuses it, alongside open #8015, which hides the steppers on coarse pointers instead. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. The implementation, its tests and the Changeset match the described behavior at this head, including the new double-tap mousedown guard, so nothing else is needed if the rule is approved as implemented; if the owner limits it to touch and pen, the guard, the no-pointer unit test and the Changeset need to follow.

[Automated review]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
…cused)

Conflict: meta#8173 puts the stepper's pointerdown and mousedown guards on each
button; here they live on the column, so the mousedown guard joins the
column's pointerdown handler and also covers a double tap in its reach.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
The helper base merges meta#8336 8588156, meta#8241 f25a28b and meta#8173
b7af21d, with nothing of this PR's own; merging it changes no file, so a
compare from it shows exactly this PR's change.
vjeux added 2 commits October 26, 2026 11:54
… mouse press

`component:NumberInput` FR5 states where focus goes when a stepper is
pressed: the steppers never take focus themselves; a mouse press moves focus
to the input, and a touch, pen, or pointerless press leaves focus where it is,
so an input being edited stays focused and a tap raises no on-screen keyboard,
as UIStepper does on iOS. The verification map names the four press kinds.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
The helper base merges meta#8336 9525df5, meta#8076 62ecda1, meta#8173
650a72b and meta#8241 debc0ee over the previous one, with nothing of this
PR's own; merging it changes no file, so a compare from it shows exactly
this PR's change.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to approve this intentional update to component:NumberInput FR5: today the steppers "keep focus on the input when pressed", and this PR rewrites FR5 so a touch, pen or pointerless press (screen-reader activation, a programmatic click()) steps the value and leaves focus where it is, while a mouse press still focuses the field. That decision also has to settle the pen path on desktop, the screen-reader activation that no longer lands on the field with nothing announcing the new value, and how this relates to open #8015, which hides the steppers on coarse pointers instead. An engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Once it is settled, two small fixes remain:

  • Retag the Changeset, since AST-017 FR5 says a change that intentionally replaces a documented contract is not a [fix]: [feat] if no consumer has to adapt, otherwise [breaking].
  • Add __tests__/NumberInput.stepper-focus.a11y.chromium.spec.ts to the record's verified_by and to the FR4/FR5 verification row.

[Automated review]

'@astryxdesign/core': patch
---

[fix] NumberInput: a finger or a pen on a number stepper, and an activation with no pointer (a screen reader, a programmatic `click()`), steps the value without focusing the field, so on a phone the on-screen keyboard no longer slides up over the page with every tap. A field that is already being edited stays focused, and a mouse click still focuses the field, so the arrow keys and the wheel keep stepping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change intentionally replaces component:NumberInput FR5 ("keep focus on the input when pressed"), and AST-017 FR5 says such a proposal "is not a fix, except an accessibility behavior fix under FR53". Once an engineering owner rules on FR5, retag under AST-017 FR7: [feat] when no consumer scenario has to adapt, [breaking] in the planned minor when one does (FR1).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retagged [feat] (patch) in 877accf, since FR5 is a documented contract this changes (spec:AST-017 FR5). The description names the one consumer scenario that could make it [breaking] instead: an onFocus that fired on a stepper press no longer fires for a finger, or for a pen or a pointerless press under a coarse pointer. The record's owner decides that with FR5.

| FR1, AR1 | `NumberInput.test.tsx` spinbutton-attribute suite; `NumberInput.a11y.chromium.spec.ts` | Bounded, unbounded, formatted | A missing role or ARIA value fails. | `audit:NumberInput/accessibility` |
| FR2, AR2 | `numberParser.test.ts`; `numberParser.docblock.test.ts`; `NumberInput.test.tsx` invalid-feedback suite | Locales, grouping, invalid text | A misparse, a commit of a guess, or a missing announcement fails. | `audit:NumberInput/behavior` |
| FR3, ORD1 | `numberInputCommit.test.ts`; `NumberInput.test.tsx` validation, commit-policy, clamping, keyboard-clearing suites | Blur, Enter, empty, clamp, inverted range | A per-keystroke `onChange`, an unclamped commit, or a wrong clear fails. | `audit:NumberInput/behavior` |
| FR4, FR5, ORD2, AR4, PR1 | `NumberInput.test.tsx` stepping and steppers suites; wheel-listener cases | Keys, wheel, steppers; bounds; empty; precision; mouse, touch, pen, and pointerless presses | A step off the grid, past a bound, or with modifiers fails, as does a mouse press that leaves the input unfocused or a touch, pen, or pointerless press that moves focus. Evidence gap: no test steps from an emptied draft over a value. | `audit:NumberInput/behavior` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed FR5 depends on touch and pen synthesis, which architecture:interaction-modality verifies only in a real browser. Add __tests__/NumberInput.stepper-focus.a11y.chromium.spec.ts to this row and to verified_by, so the record points at its browser proof.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2bc7c38: the record's verified_by and the FR4/FR5 verification row name NumberInput.stepper-focus.a11y.chromium.spec.ts, which now also proves a pointerless press under a fine and a coarse primary pointer.

vjeux added 2 commits October 26, 2026 15:13
The record's verified_by and the FR4/FR5 verification row name
`NumberInput.stepper-focus.a11y.chromium.spec.ts`, which proves the touch and
mouse presses in a real browser.
…nput where the primary pointer is fine

Where the primary pointer is fine no on-screen keyboard comes up, so a pen
press (a desktop tablet's) and an activation with no pointer (a desktop
screen reader's, a programmatic `click()`) move focus to the input as a mouse
click does: the arrow keys and the wheel keep stepping, and a screen reader
reads the new value. A finger never moves focus, and where the primary
pointer is coarse neither does a pen or an activation with no pointer. The
record's FR5 and its verification row say so, the Changeset is a `[feat]`
(a documented contract changes, `spec:AST-017` FR5), and the Chromium spec
proves the pointerless case under both pointers.
@vjeux vjeux changed the title fix(NumberInput): a finger on a stepper no longer raises the keyboard feat(NumberInput): a finger on a stepper no longer raises the keyboard Oct 26, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is waiting on an engineering owner to approve this intentional update to component:NumberInput FR5: today the steppers "keep focus on the input when pressed", and this PR makes a touch press, and a pen or pointerless press on a coarse pointer, step the value without focusing the field, which also means a phone screen-reader activation no longer lands on the field, onFocus and onBlur stop firing around those presses (deciding [feat] against [breaking]), and the rule overlaps open #8015. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently, one fix is needed: the pointer type stored on pointerdown survives a press that never clicks (a mouse press dragged off, a cancelled touch), so the next pointerless click on a fine pointer skips focusing the field; treat a click with event.detail === 0 as pointerless, or clear the stored type on pointercancel, and add a unit test for that sequence.

[Automated review]

) => {
// The stepper never takes focus: an editing field stays focused.
event.preventDefault();
stepperPointerTypeRef.current = event.pointerType;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A press that never becomes a click on this stepper (a mouse press dragged off before release, or a touch the browser cancels for a scroll) leaves this type behind, and the next click with no pointer press reads it. On a fine pointer a stale 'mouse' or 'touch' then skips the focus() at line 948, although proposed FR5 (and main) focus the field for a pointerless press there. Treating a click with event.detail === 0 as pointerless in pressStepper, or clearing the ref on pointercancel, fixes it; a unit test that fires pointerDown and then a bare click covers it.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
NumberInput.spec.md takes meta#8173's record (FR5 by press kind and pointer, its
verification row and verified_by) with this PR's hold amendment re-applied
(FR4, the Behavior row, the verification row and verified_by).
NumberInput.test.tsx takes meta#8173's focus tests: its touch tap stands for
this PR's untracked touch click, and its fine- and coarse-pointer cases
replace the pointerless no-focus test FR5 no longer states.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…n a half does

With meta#8173's FR5, a pen press and an activation with no pointer focus the
field where the primary pointer is fine, as a mouse click does. A press on
the column itself (its border) now follows the same rule through one helper
(focusAfterPress) instead of focusing for a mouse only; a click no pointer
sent there moves no focus, since only a pointer presses the column. The pen
tap test follows FR5 under a fine pointer, and a coarse-pointer pen tap
steps without focus.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
It adds meta#8173 877accf and meta#8336 33bff16 to the previous helper base;
merging it changes no file, so a compare from it shows exactly this PR's
change.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…he column press follows it)

NumberInput.spec.md takes meta#8205's record (meta#8173's FR5 and the hold) with this
PR's capsule amendment re-applied (FR5 placement, the Steppers design row,
the verification row and verified_by).
@cixzhang cixzhang closed this Oct 28, 2026
@cixzhang cixzhang reopened this Oct 28, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

Posted by Cindy's agent on her behalf: closed and reopened only to restart this PR's CI on the current workflow after tonight's queue-wide cancel; nothing in the PR changed.

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:32
@vjeux

vjeux commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #8015: NumberInput's steppers are now hidden under a coarse primary pointer, so a finger's stepper tap no longer happens on phones.

@vjeux vjeux closed this Oct 31, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
It adds meta#8173 877accf and meta#8336 33bff16 to the previous helper base;
merging it changes no file, so a compare from it shows exactly this PR's
change.

This branch was successfully deployed

1 active deployment
Preview — 877accfb Deployed Oct 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants