Skip to content

fix(input): stop mouse wheel from changing number input values - #5

Merged
BrianGenisio merged 2 commits into
mainfrom
fix/number-input-scroll
Aug 12, 2026
Merged

fix(input): stop mouse wheel from changing number input values#5
BrianGenisio merged 2 commits into
mainfrom
fix/number-input-scroll

Conversation

@BrianGenisio

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional components/input/input.js helper that fixes the default browser behavior where scrolling the mouse wheel over a focused <input type="number"> increments/decrements its value.
  • The helper blurs the focused number input on wheel, so the value stays put and the page keeps scrolling normally (no preventDefault).
  • Uses a single delegated, passive listener on document and auto-initializes, so it covers both existing and dynamically added .input[type="number"] fields without re-init. Exposed as a default export, a named export, and window.preventNumberInputScroll, and returns a cleanup function for scoped/manual use.

Docs & wiring

  • components/input/test.html: loads the module and notes the behavior on the numeric field for live verification.
  • components/input/README.md: new "Scroll-to-Change Fix (JavaScript)" section + dependency note.
  • AGENTS.md: Input section usage, JS imports list, key principles, version info, and file tree.
  • llms.txt: Input entry + file structure.

Test plan

  • Open components/input/test.html, focus a numeric input, and scroll the mouse wheel — value should not change and the page should scroll.
  • Confirm text inputs and other controls are unaffected.
  • Confirm dynamically added .input[type="number"] fields are also covered.

Made with Cursor

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca1e8151-2e4f-4e24-9f2a-4f30465c72e6

📥 Commits

Reviewing files that changed from the base of the PR and between d5503bb and b54e307.

📒 Files selected for processing (6)
  • agents.md
  • components/input/README.md
  • components/input/input.js
  • components/input/test.html
  • llms.txt
  • tests/input-number-scroll.spec.js

Comment @coderabbitai help to get the list of available commands.

Brian Genisio and others added 2 commits August 12, 2026 15:17
Add optional input.js helper that blurs a focused .input[type="number"]
on wheel so scrolling no longer mutates the value while the page still
scrolls. Uses delegated, auto-initializing listener and documents usage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Assert the browser default still mutates values, and that input.js keeps
the value stable for static and dynamically added fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BrianGenisio
BrianGenisio force-pushed the fix/number-input-scroll branch from a09c4ce to b54e307 Compare August 12, 2026 19:17
@BrianGenisio

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and added Playwright coverage:

  • tests/input-number-scroll.spec.js — browser default still changes the value; with input.js, static + dynamically added .input[type=number] keep their value and blur on wheel
  • Full suite: npm test → 33 passed

@BrianGenisio
BrianGenisio merged commit d21d15d into main Aug 12, 2026
2 checks passed
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.

1 participant