Closed Bug 287461 Opened 19 years ago Closed 19 years ago

Caret Browsing is hardbound to the F7 key and is unable to be overridden with javascript like F3, F5, etc.

Categories

(Firefox :: Keyboard Navigation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox1.5

People

(Reporter: lindsey, Assigned: kinger)

Details

(Keywords: helpwanted)

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1

I have an application that uses the function keys F1 through F12 for navigation.
I am able to override F3, F5, etc, through use of the Javascript
preventDefault() option, but unfortunatly it seems that the F7 key, which is
bound to a Caret Browsing dialog and the caret browsing toggle, does not use
Javascript events. It is actually bound in browser.xbl as an XBL handler
(http://lxr.mozilla.org/aviary101branch/source/toolkit/content/widgets/browser.xml#780),
which means that, as far as I can tell, there is no way to override it and stop
it toggling caret browsing.

The best solution that I can think of would be to move the F7 button to use the
same Javascript events that F3, F5, etc use, thus allowing it to be overridden
if desired.

Reproducible: Always

Steps to Reproduce:
1. Rebind F7 by using a Javascript event listener bound to keydown.
2. Use preventDefault() to stop the event from opening a dialog and toggling
caret browsing.
3.

Actual Results:  
Nothing - the dialog and toggle still appear.

Expected Results:  
Allowed me to override F7 like I have done with F3, F5, etc, by using the
preventDefault() function.
The reason the key is in the binding is so that any user of <browser> gets that
keystroke for free. Otherwise developers are most likely to forget it, yet it is
an important keystroke for accessibility -- for example in help, view source,
even in Chatzilla content.

I have no problem with using a different strategy to implement F7 to solve the
problems discussed in this bug, but we should continue to support it. Sun
Microsystems, especially, uses this feature for their screen reader strategy.
Some users need the key to be able to select text without need for a mouse.
Keywords: helpwanted
Why not just role out a browser binding in the moz app that doesn't have the F7
handler? 
(In reply to comment #2)
> Why not just role out a browser binding in the moz app that doesn't have the F7
> handler? 

Unfortunately this isn't something we're able to do with our application at the
moment. The (initial) goal is to be able to run it off a standard install of
Firefox from a web server with no need to install extensions, etc.

Who knows, our clients might even start using Firefox for general browsing, and
some of them might want to use F7 :)
The proposal is not to remove this key, but to move it out of the binding.

What I propose is:
- move the key into one of the existing XUL keysets.
- move the JS to browser.js or a more appropriate utility file if there is one.

Aaron, would you consider a patch if I put one together?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Brian, it's okay with me. Request r= from ginn.chen@sun.com and sr= from
neil@parkway.cc.co.uk
Copying Ginn and Neil for feedback. Do you have any objections before I proceed
with a patch to this key being moved out of the binding?

My fix would likely be:
- move the key to <keyset id="mainKeyset"> (browser-sets.inc)
- Move the JS to browser.js

Assignee: aaronleventhal → brian
You should be able to make the browser binding respect preventDefault():
* Put the handler in the system event group (see bug 225563).
* Check to see if preventDefault() was called on the event.
Attached patch Look for preventDefault (obsolete) — Splinter Review
Neil, you mean something like this (not tested yet)?
Attachment #181269 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 181269 [details] [diff] [review]
Look for preventDefault

That seems to work, although I'd prefer to see the !event.isTrusted after the
|| to avoid confusion over precedence.
Attachment #181269 - Flags: review?(neil.parkwaycc.co.uk) → review+
Oh, and r+sr too for the xpfe version tweaked as per my comment.
Attached patch Updated patch (obsolete) — Splinter Review
Order in conditional is reversed here as requested.

Neil, if it's OK can you check it in please (I've tested), I don't have checkin
rights.
Attachment #181269 - Attachment is obsolete: true
Attachment #181281 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 181281 [details] [diff] [review]
Updated patch

You'll need approval, as the tree is currently frozen.
Attachment #181281 - Flags: review?(neil.parkwaycc.co.uk) → review+
Brian, when the tree is open, I can check it in for you if need be ...
What about Mozilla Suite?
Are you going to fix it?
(In reply to comment #14)
> What about Mozilla Suite?
> Are you going to fix it?

Good point. Updated patch coming ...
Patch that now includes browser.xml of Mozilla Suite.
Attachment #181281 - Attachment is obsolete: true
Attachment #181524 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 181524 [details] [diff] [review]
Include Mozilla Suite binding

r+sr=me
Attachment #181524 - Flags: review?(neil.parkwaycc.co.uk) → review+
I'd be grateful if any of you fine people could check this in once the tree is
open again. Thanks!
Status: NEW → ASSIGNED
Seeking driver review for checkin to trunk.
Target Milestone: --- → Firefox1.1
Attachment #181524 - Flags: approval-aviary1.1a2?
Comment on attachment 181524 [details] [diff] [review]
Include Mozilla Suite binding

a=shaver
Attachment #181524 - Flags: approval-aviary1.1a2? → approval-aviary1.1a2+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: