Closed
Bug 513186
Opened 15 years ago
Closed 15 years ago
Button in alert() dialog no longer gets initial focus
Categories
(Core :: XUL, defect, P1)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: jruderman, Assigned: enndeakin)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 2 obsolete files)
7.92 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
I assume this was caused by bug 494345 (see bug 503829 comment 7). In general, non-editable text labels should be skipped by the "focus the first focusable thing" heuristic.
Flags: blocking1.9.2?
Assignee | ||
Comment 1•15 years ago
|
||
This patch just steps past the description when opening the dialog. Not a great fix I think, but maybe someone has a better idea?
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•15 years ago
|
||
Maybe people from bug 335089 would have an idea.
Comment 3•15 years ago
|
||
I take it there's no way to emulate the old "focusable, but not tabbable" behaviour that the <description> used to have?
Assignee | ||
Comment 4•15 years ago
|
||
(In reply to comment #3) > I take it there's no way to emulate the old "focusable, but not tabbable" > behaviour that the <description> used to have? Not currently, unless we add support for tabindex to all xul elements and not just nsIDOMXULControlElements. Or ideally, just fix bug 474440.
Flags: blocking1.9.2? → blocking1.9.2+
Priority: -- → P1
Assignee | ||
Comment 5•15 years ago
|
||
This approach adds an initialfocus attribute which may be used to specify the initial focus in a dialog. This patch also fixes bug 517819. Thoughts?
Attachment #402418 -
Flags: review?(neil)
Comment 6•15 years ago
|
||
Comment on attachment 402418 [details] [diff] [review] another approach I don't think this patch is correct as written. For commonDialog.xul, the focus priority is the first text field (if any) otherwise the default button (except for the Mac), and it looks like this patch would break that. Maybe you should have an ignoreinitialfocus attribute, and dialog.xml should look for non-tab elements without that attribute to find something to focus? >+ var initialFocus = dialog.initialFocus; >+ initialFocus = document.getElementById(dialog.initialFocus); ??? >+ initialFocus.focus(); What if it's a textbox?
Attachment #402418 -
Flags: review?(neil) → review-
Comment 7•15 years ago
|
||
And you could set ignoreinitialfocus on commonDialog's checkbox too, and then dialog.xml would handle focus correctly without needing commonDialog.js help.
Assignee | ||
Comment 8•15 years ago
|
||
Ah yes, I had meant to make the commonDialog changes mac specific behaviour. I'll think about how an ignoreinitialfocus attribute might work.
Assignee | ||
Comment 9•15 years ago
|
||
This doesn't fix bug 517819 due to it focusing the inner input, although I can't get that bug to be reproduced any more.
Attachment #397667 -
Attachment is obsolete: true
Attachment #402418 -
Attachment is obsolete: true
Attachment #403337 -
Flags: review?(neil)
Comment 10•15 years ago
|
||
(In reply to comment #7) > And you could set ignoreinitialfocus on commonDialog's checkbox too, and then > dialog.xml would handle focus correctly without needing commonDialog.js help. Hmm, that's not quite true, since the desired outcome is * If textfield exists, focus it * If non-Mac, focus default button * If checkbox exists, focus it * Otherwise, focus leftmost button So the checkbox would have to #ifdef the noinitialfocus attribute, which is not worth it just to avoid one (excluding #ifdef) line of code in commonDialog.js
Comment 11•15 years ago
|
||
Comment on attachment 403337 [details] [diff] [review] what about this >+<script type="application/javascript" >+ src="chrome://mochikit/content/MochiKit/packed.js"/> Nit: trailing space after "application/javascript"
Attachment #403337 -
Flags: review?(neil) → review+
Whiteboard: [needs landing]
Whiteboard: [needs landing]
Is this ready to land?
Assignee | ||
Comment 13•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/b8aa319fa2dd This bug adds a boolean attribute for all xul elements 'noinitialfocus' which, when true, indicates that when the element is in a dialog, the element is skipped when determining which element should be initially focused in the dialog. For example, generally the first focusable element will be focused (varies on each platform). This attribute may be used to skip those elements when checking for that first element.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Keywords: dev-doc-needed
Resolution: --- → FIXED
Updated•15 years ago
|
Whiteboard: [doc-waiting-1.9.3]
Assignee | ||
Updated•15 years ago
|
status1.9.2:
--- → beta1-fixed
Comment 14•15 years ago
|
||
I had to back this out because test_dialogfocus.xul was failing on OS X with: Error 0 (Unknown error: 0).6153 ERROR TEST-UNEXPECTED-FAIL | chrome://mochikit/content/chrome/toolkit/content/tests/chrome/test_dialogfocus.xul | Test timed out. http://tinderbox.mozilla.org/showlog.cgi?log=Firefox3.6-Unittest/1254865752.1254867383.20632.gz
Updated•15 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 15•15 years ago
|
||
Bug is still fixed on trunk though.
Status: REOPENED → RESOLVED
Closed: 15 years ago → 15 years ago
status1.9.2:
beta1-fixed → ---
Resolution: --- → FIXED
Comment 16•15 years ago
|
||
Indeed, sorry about that.
Comment 17•15 years ago
|
||
Can this land on mozilla-1.9.2? It blocks the beta ...
Assignee | ||
Comment 18•15 years ago
|
||
Woops, I checked it earlier today, with the test disabled on Mac.
status1.9.2:
--- → beta1-fixed
Comment 19•15 years ago
|
||
(In reply to comment #18) > Woops, I checked it earlier today, with the test disabled on Mac. http://hg.mozilla.org/releases/mozilla-1.9.2/rev/812c49feab66
Comment 20•14 years ago
|
||
To what elements does this apply? At first blush, this seems more an implementation detail of how alerts work internally than something that necessarily cries out for documenting.
Whiteboard: [doc-waiting-1.9.3]
Assignee | ||
Comment 21•14 years ago
|
||
Normally, a platform-specific algorithm is used to determine what element is first focused when a dialog opens. For instance, this might select the first element in the dialog. This bug adds a 'noinitialfocus' attribute to all xul elements which when set to true, indicates that that element should be skipped when determining what should be first focused. This is useful for focusable descriptions as in the alert box. If noinitialfocus is not set or false, that element may be focused first, assuming the algorithm determines that it should be initially focused. The attribute only has any effect in dialogs (or wizards).
Comment 22•14 years ago
|
||
The fix for this bug seems to have caused bug 550539.
Comment 23•14 years ago
|
||
Documented here: https://developer.mozilla.org/en/XUL/Attribute/noinitialfocus
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•