Closed Bug 302093 Opened 20 years ago Closed 17 years ago

flickering with non-digit input in history/cache textboxes

Categories

(Firefox :: Settings UI, defect)

defect
Not set
trivial

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: tonglebeak, Assigned: tonglebeak)

Details

(Keywords: polish)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050725 Firefox/1.0+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050725 Firefox/1.0+ Flickering due to parseInt changing the textbox value if a non-digit key is pressed. Very minor, bikeshed problem, but nonetheless I'd like to see this fixed sometime in the future. Reproducible: Always
Keywords: polish
OS: Windows XP → All
Hardware: PC → All
Version: unspecified → Trunk
Assignee: nobody → tonglebeak
Status: UNCONFIRMED → NEW
Ever confirmed: true
This prevents non-digit keys from being pressed. The exceptions are delete, backspace, and the arrow keys. I'm not going to request any review on this at this time since it's too trivial, and 1.9 branching is very close, but it's here for people to test and provide input upon.
Comment on attachment 190635 [details] [diff] [review] filter out non-digit keypresses mconnor, I'm fully aware of your concerns about pasting text into the box, here it goes: IE will accept non-digit pasting, and when ok'ed the history is set to 99 days. Rather than doing something stupid like that, I figured we should leave the parseInt in as a fail-safe, and since very few people actually paste numbers into the boxes, pasting shouldn't be causing any worries. Bottom line is that this flat-out stops non-digit key input (but does allow delete, backspace, and arrow keys), and thus resolves the flickering. And for anyone who actually cares to try to screw with it, parseInt is still there as a failsafe.
Attachment #190635 - Flags: review?(mconnor)
Why not use something like checkInteger()? The only possible values can be integers, so why not just check to see if the values an integer, instead of checking if it's not an integer? http://lxr.mozilla.org/mozilla/source/toolkit/components/printing/content/printdialog.js#94 http://lxr.mozilla.org/mozilla/source/toolkit/components/printing/content/printdialog.xul#99
The regex in my function DOES check for an integer, and will return false if it's not an integer (or any of the special keys). Here's how it works: you got your testInput() and specialKeys(). if (!testInput && !specialKeys), then no valid key was pressed, so it's returned true, but then it's NOT because of the ! outside all of that. Only one of the conditions have to be met to succeed (as it's only doing with one keypress, make sense?). Plus, onkeyup, someone can hold down the key, can they not, and have letters go up the wazoo, then let go and watch it all reset to nothing. This just stops that period.
Status: NEW → ASSIGNED
Comment on attachment 190635 [details] [diff] [review] filter out non-digit keypresses Cancelling for now until a possible better fix is discussed with mconnor.
Attachment #190635 - Flags: review?(mconnor)
This is now a WFM Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9) Gecko/2008062219 (Gentoo) Firefox/3.0 Anyone else still having this problem?
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: