Skip to content

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

Merged
atomiks merged 6 commits into
mui:masterfrom
alex-js-ltd:fix/number-field-stop-hold-when-disabled
Aug 11, 2026
Merged

atomiks merged 6 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
Contributor

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
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5435
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5435
    

commit: 1b9f4a8

@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 🔺+73B(+0.02%) 🔺+17B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,228.00 ms +49.76 ms(+4.2%) | Renders: 76 (+0) | Paint: 1,913.65 ms +60.84 ms(+3.3%)

Test Duration Renders
Menu mount (300 instances) 121.68 ms 🔺+25.61 ms(+26.7%) 1 (+0)
Combobox open — 500 items 40.54 ms ▼-12.85 ms(-24.1%) 4 (+0)

13 tests within noise — details

Metric alarms

Test Metric Change
Menu mount (300 instances) bench:paint 🔺 +38.37 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!

Name Link
🔨 Latest commit 1b9f4a8
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a7ada7cd1447400087e80a9
😎 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.

@atomiks atomiks added component: number field Changes related to the number field component. type: bug It doesn't behave as expected. labels Aug 11, 2026

@atomiks atomiks 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.

Thanks for the fix @alex-js-ltd

@alex-js-ltd

Copy link
Copy Markdown
Contributor Author

Thanks for the fix @alex-js-ltd

no problem

@atomiks
atomiks merged commit 0393d9e into mui:master Aug 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: number field Changes related to the number field component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants