Skip to content

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

Open
BrianGenisio wants to merge 1 commit into
mainfrom
fix/number-input-scroll
Open

fix(input): stop mouse wheel from changing number input values#5
BrianGenisio wants to merge 1 commit 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

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>
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@BrianGenisio, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 28 minutes and 17 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eebe9bba-8661-4f83-ac55-54403387ff00

📥 Commits

Reviewing files that changed from the base of the PR and between ec0b145 and a09c4ce.

📒 Files selected for processing (5)
  • agents.md
  • components/input/README.md
  • components/input/input.js
  • components/input/test.html
  • llms.txt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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