Open Bug 333164 Opened 19 years ago Updated 3 years ago

Allow disabling of javascript focus()

Categories

(Core :: DOM: Core & HTML, enhancement, P5)

enhancement

Tracking

()

People

(Reporter: bugzilla.6.capybara, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060124 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060124 Firefox/1.5.0.1 I find it very annoying that scripts are allowed to move the text cursor around automatically. In my opinion, it should go where I put it and stay there until I press TAB or click in another field. But there are a number of web pages that try to help me out by moving the focus automatically to the field that they think I want to type into. This means that I have to constantly monitor the screen while typing to make sure the cursor hasn't jumped anywhere else. Okay, it's not so bad on google, but there are a lot of sites that ask for a phone number, divided into several fields: I type 626 TAB 123 TAB 4567... and notice that the text has gone into the wrong places, because some overhelpful script was automatically moving the cursor to the next field. So how about a preference in the list of advanced javascript options allowing me to disable all focus() requests? You can call it "Allow scripts to move the text cursor." I realize this is really minor, but it would be nice. Reproducible: Always Steps to Reproduce:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a1) Gecko/20060407 Firefox/3.0a1 - Build ID: 0000000000 Confirmed; it would be a nice feature to have.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: allow disabling of javascript focus in text fields → Allow disabling of javascript focus()
Assignee: nobody → general
Component: Preferences → DOM
OS: Linux → All
Product: Firefox → Core
QA Contact: preferences → ian
Hardware: PC → All
Version: unspecified → Trunk
Could probably just add a pref check to nsGenericElement::ShouldFocus. When (if) this bug is fixed, another bug should be filed for adding UI for this.
> I type 626 TAB 123 TAB 4567... and notice that the text has gone into the > wrong places, because some overhelpful script was automatically moving > the cursor to the next field. I've had that happen to me too. I wonder if one could create a Greasemonkey script that prevents this kind of use of textbox.focus() without breaking more helpful uses (e.g. Google). I think you can prevent web pages from changing focus by setting capability.policy.default.HTMLInputElement.focus to noAccess. You might be able to do that using about:config or you might have to edit prefs.js. I doubt we'd add a checkbox in prefs for this. See also bug 226386, "Should not change focus in onload() when the user changed it before the load is complete".
Assignee: general → nobody
QA Contact: ian → general
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.