Skip to content

Comments

fix: Prevent <TextInput type="number"> from changing value on scroll#413

Open
maximo-macchi-cb wants to merge 4 commits intomasterfrom
max/text-input-num-scroll-change
Open

fix: Prevent <TextInput type="number"> from changing value on scroll#413
maximo-macchi-cb wants to merge 4 commits intomasterfrom
max/text-input-num-scroll-change

Conversation

@maximo-macchi-cb
Copy link
Contributor

What changed? Why?

This PR updates the behavior of <TextInput> so that when the input is focused, a user scrolling won't update the value of the input. This is expected behavior in Chrome and Firefox but not Safari.

This was reproducible in CDS. Interestingly, I could not reproduce this on a basic <input type="number"> MDN example.

This PR's changes accomplishes two things:

  • Creates more browser behavior parity
  • Improves the UX by removing accidental input value changes that can easily be made by users

Root cause (required for bugfixes)

Native browser behavior adjust the input's value on the wheel event. This is not caused by CDS code.

UI changes

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Verify using the newly added <TextInput> story with a <TextInput type="number">.

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@maximo-macchi-cb maximo-macchi-cb self-assigned this Feb 19, 2026
@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Feb 19, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

Copy link
Contributor

@sverg-cb sverg-cb left a comment

Choose a reason for hiding this comment

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

Can you provide a before-and-after of the scroll event on Web?
Otherwise, will stamp after release/changelog commit

@maximo-macchi-cb
Copy link
Contributor Author

Can you provide a before-and-after of the scroll event on Web? Otherwise, will stamp after release/changelog commit

I didn't post a screenshot or video since that wouldn't really capture the change. But you can use this example to see how the <TextInput> behaves currently. When a value is entered and you focus on the input then scroll inside of it, the value changes

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

Development

Successfully merging this pull request may close these issues.

3 participants