Skip to content

[number field] Stop incrementing when disabled during press-and-hold - #5435

Open
alex-js-ltd wants to merge 3 commits into
mui:masterfrom
alex-js-ltd:fix/number-field-stop-hold-when-disabled
Open

[number field] Stop incrementing when disabled during press-and-hold#5435
alex-js-ltd wants to merge 3 commits into
mui:masterfrom
alex-js-ltd:fix/number-field-stop-hold-when-disabled

Conversation

@alex-js-ltd

@alex-js-ltd alex-js-ltd commented Aug 8, 2026

Copy link
Copy Markdown

Changes

Stops an active Number Field press-and-hold interaction when the field becomes disabled.

usePressAndHold now observes its effective disabled state and calls stopAutoChange() when it becomes true. This clears the pending timeout and repeating interval while preserving the existing pointer-release handling.

Test

Added a regression test that starts holding the increment button, disables the Number Field, waits beyond the repeat delay, and verifies that the value remains 1. Before the fix, the pending hold timer performed another increment and changed the value to 2.

  • pnpm test:jsdom NumberField --no-watch
  • pnpm test:chromium NumberField --no-watch

Fixes #5434

@alex-js-ltd
alex-js-ltd marked this pull request as ready for review August 8, 2026 14:38
@pkg-pr-new

pkg-pr-new Bot commented Aug 8, 2026

Copy link
Copy Markdown

commit: 4a43e4a

@code-infra-dashboard

code-infra-dashboard Bot commented Aug 8, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+32B(+0.01%) 🔺+5B(0.00%)

Details of bundle changes

Performance

Total duration: 1,318.78 ms +104.13 ms(+8.6%) | Renders: 76 (+0) | Paint: 2,056.11 ms +124.46 ms(+6.4%)

Test Duration Renders
Popover mount (300 instances) 63.65 ms 🔺+10.99 ms(+20.9%) 1 (+0)

14 tests within noise — details

Metric alarms

Test Metric Change
Popover mount (300 instances) bench:paint 🔺 +18.10 ms

Check out the code infra dashboard for more information about this PR.

@alex-js-ltd alex-js-ltd changed the title [number field] Stop press-and-hold when disabled [number field] Stop incrementing when disabled during press-and-hold Aug 8, 2026
@netlify

netlify Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4a43e4a
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a7745dc4a1cef000735742a
😎 Deploy Preview https://deploy-preview-5435--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[number field] Press-and-hold continues after field becomes disabled

1 participant