Closed Bug 58853 Opened 24 years ago Closed 23 years ago

Dialog boxes should always get initial keyboard focus

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement, P3)

enhancement

Tracking

()

VERIFIED FIXED
mozilla1.1alpha

People

(Reporter: aaronlev, Assigned: aaronlev)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(2 files, 1 obsolete file)

When first entering a dialog box, there should always be an inital keyboard
focus.Right now you usually need to press TAB an extra time to get your focus
somewhere.

A side effect of there not being an initial focus, is that confirm/cancel
dialogs require TAB for space hits the OK button.
Keywords: access
I'd put this higher than an enhancement, its a bug.
It's not a dupe, but this is related to bug 54887, I think. 
See also bug 35087, dialog with one text field should set focus (programmers 
shouldn't have to manually set focus for each dialog).
Since Don has left, Vishy is taking his bugs in bulk, pending reassignment.
thanks,
	Vishy
Assignee: don → vishy
Blake just fixed this for dialogs that only have buttons (bug 63647).
Not just with buttons. If it has a textfield, that gets focus first.  Only for 
common dialogs, though (alerts, etc.)
Okay, hopefully we're still going to make this the default behavior for any UI 
window that's opened, not just common dialogs.
nsbeta1
Keywords: nsbeta1
saari, aaron says he can help.
Assignee: vishy → saari
nav triage team:

Marking nsbeta1+
Whiteboard: nsbeta1+
This is soo far off my radar for this release it isn't even funny. If you want
this fixed in that time frame, assign it to Aaron or someone else.
I should be able to handle this in a couple of weeks, when the XUL content 
model moves back into layout (Waterson's change). Hyatt and I were talking 
about leveraging the GetNextTabbableContent method in nsEventStateHandler, and 
exposing it in the XUL DOM through 
document.commandDispatcher.getNextTabbableContent(BOOL forward). 

I'd solve the problem as follows: in the XBL binding for <window 
class="dialog" ...> onload handler we check to see if the focus is already on a 
specific element (not the window as a whole). If it isn't, we move it to the 
first item using GetNextTabbableContent. If the first item is a tab widget, 
move it beyond the tab widget (this makes Ben Goodger happy). 

This solution works whether our onload handler gets called after the dialog's, 
or before it. If it gets called first, the window's handler still gets a chance 
to set focus. If it gets called after the window handler set a focus, we won't 
do anything because we check to see if the focus was already set. Therefore, we 
don't need to worry about the outcome of any bugs having to do with the order 
of onload event handling.
over to aaronl, if that be okay...
Assignee: saari → aaronl
Blocks: 35087
Status: NEW → ASSIGNED
Keywords: nsbeta1
Whiteboard: nsbeta1+
Target Milestone: --- → mozilla1.1
I have implemented this in my tree.  jst and saari have reviewed.  aaronl, I can
take this bug off your hands if you want.
How'd you do it? Did you expose GetNextTabbableContent like we talked about?
Assignee: aaronl → hyatt
Status: ASSIGNED → NEW
i presume this bug covers the fact that the following dialogs don't have initial
focus set [if so, it goes hand in hand with bug 76814]:

Preferences
Account Settings
Customize Sidebar
Cookie Manager
Image Manager
Password Manager
both dialogs dealing with form data management

for me this is primarily a problem on linux and mac [not so much on win32].
*** Bug 82384 has been marked as a duplicate of this bug. ***
Add the Address Book, "Card for <name>" dialog to this list. Dup'd bug 82384.

1.Open the Address Book
2.Open an existing AB entry by either double clicking or using the Edit menu.
3."Card for <name>" dialog opens but nothing has focus.

Expected:
The first text field, "First" name should have focus.
There is a method on the commandDIspatcher now that will do this.  If ben ever 
gets around to making a <dialog> binding, he should be able to build the focus 
advancement into the binding behavior.
It shouldn't be specific to <dialog>s -- <window>s should have default focus set
too, though many of them will adjust the focus themselves.
*** Bug 91700 has been marked as a duplicate of this bug. ***
the lack of initial key focus for enter/esc (ok/cancel) in dialogs is 
embarrasing. why is this 1.1?
It is 1.1 because dialog writers can set initial focus in onenddocumentload, and
because we don't want to go mucking around with focus and changing behavior
unless we really, really have to. Why, just this weekend the inital focus
screwed up rendering from jag's patch.

You're more than welcome to try and fix it if you want pink.
Blocks: focusnav
*** Bug 76814 has been marked as a duplicate of this bug. ***
*** Bug 97578 has been marked as a duplicate of this bug. ***
I'm guessing this patch works because it delays advanceFocusIntoSubtree() until
the the frame tree has been created.

It doesn't fix the account wizard, which doesn't seem to use either <dialog />
or <wizard />. In fact, nothing seems to use <wizard>, so I'm not sure why we
have wizard.xml at all.
Yeah, that's right.  <wizard> is new, nobody is using it yet, but they should be. :)

sr=hyatt.  Feel free to take the bug, aaronl.
I checked in the patch to fix bug 103036.
I can't mark this fixed because it doesn't seem to fix all windows, only those
created with <dialog>
Assignee: hyatt → aaronl
Attachment #52199 - Attachment is obsolete: true
Trying to bind to window causes many problems.  FOr now, you just can't do it. 
Anyway the better solution is to start converting the dialogs over to <dialog>.
Wizards are still a problem.

They have been spun off to bug 103348
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
vrfy fixed --at least for Prefs, Find and the helper app dialog.

bugs for specific dlgs should be/have been filed seperately. :)
Status: RESOLVED → VERIFIED
Component: Keyboard: Navigation → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: