Skip to content

fix(number-input): preserve cursor position when deleting characters - #24028

Merged
annawen1 merged 6 commits into
carbon-design-system:mainfrom
JoshPF:number-input-focus-fix
Nov 16, 2026
Merged

annawen1 merged 6 commits into
carbon-design-system:mainfrom
JoshPF:number-input-focus-fix

Conversation

@JoshPF

@JoshPF JoshPF commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #24027

{{short description}}

Changelog

Fixed NumberInput moving the cursor to the end of the field after deleting a character in the middle of the input.

Testing / Reviewing

  1. Enter 12345 into a NumberInput.
  2. Move the cursor in between the 3 and the 4.
  3. Type backspace twice.
  4. Ensure that the two numbers deleted are the 3 and the 2, and that the input is 145.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Followed the
    required v12 migration documentation
    for any code change that affects v12, or struck through this item because
    the PR does not affect v12
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide.

@netlify

netlify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

👷 Deploy request for v12-carbon-react pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 87fbd33

@netlify

netlify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v12-carbon-web-components ready!

Name Link
🔨 Latest commit 09429dc
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-web-components/deploys/6af5cb0c11e97bd1cf708f10
😎 Deploy Preview https://deploy-preview-24028--v12-carbon-web-components.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.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the DCO.
Posted by the DCO Assistant Lite bot.

@JoshPF

JoshPF commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@JoshPF

JoshPF commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

recheck

@netlify

netlify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 87fbd33
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6af5cb2716e77b50a708cd65
😎 Deploy Preview https://deploy-preview-24028--v11-carbon-react.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.

@netlify

netlify Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 87fbd33
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6af5cb27d6e1fedf9ae518af
😎 Deploy Preview https://deploy-preview-24028--carbon-elements.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.

heloiselui and others added 4 commits November 12, 2026 09:19
…gn-system#23590)

* fix(tabs): correct overflow boundaries and RTL scrolling

* fix(tabs): observe stable sizes when updating overflow buttons

---------

Co-authored-by: Heloise Lui <71858203+heloiselui@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@JoshPF
JoshPF marked this pull request as ready for review November 12, 2026 14:24
@JoshPF
JoshPF requested a review from a team as a code owner November 12, 2026 14:24
@carbon-monitor-agent

Copy link
Copy Markdown
Collaborator

[AI agent review — Carbon grounded] · Looks Good · Reviewed by: IBM Bob · Commit: 87fbd33

This PR makes NumberInput with type=number render the controlled value prop directly so the cursor position is preserved when deleting characters in the middle of the input, and adds a regression test. No findings.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (1e17b61) to head (87fbd33).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24028      +/-   ##
==========================================
- Coverage   91.19%   90.49%   -0.71%     
==========================================
  Files         906      814      -92     
  Lines       81045    78933    -2112     
  Branches    10692    10269     -423     
==========================================
- Hits        73911    71427    -2484     
- Misses       6942     7303     +361     
- Partials      192      203      +11     
Flag Coverage Δ
angular ?
main-packages 88.09% <100.00%> (-0.14%) ⬇️
web-components 91.21% <ø> (-0.72%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@annawen1
annawen1 enabled auto-merge November 16, 2026 17:59
@annawen1
annawen1 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into carbon-design-system:main with commit 673775a Nov 16, 2026
45 of 56 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

The content of this pull request will be made available as part of our next release. For the full schedule of upcoming releases, check out our Release Radar page.

This branch was successfully deployed

1 active deployment
@carbon/react storybook preview — 87fbd33e Deployed Nov 16, 2026 by JoshPF via react-storybook-preview #45166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: NumberInput resets cursor position to the end of the input after deleting or creating a character in the middle of the input

6 participants