fix(input): stop mouse wheel from changing number input values#5
fix(input): stop mouse wheel from changing number input values#5BrianGenisio wants to merge 1 commit into
Conversation
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>
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
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. Comment |
Summary
components/input/input.jshelper that fixes the default browser behavior where scrolling the mouse wheel over a focused<input type="number">increments/decrements its value.wheel, so the value stays put and the page keeps scrolling normally (nopreventDefault).documentand 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, andwindow.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
components/input/test.html, focus a numeric input, and scroll the mouse wheel — value should not change and the page should scroll..input[type="number"]fields are also covered.Made with Cursor