Closed
Bug 360437
Opened 18 years ago
Closed 17 years ago
nsITypeAheadFind: get rid of aHasFocus argument
Categories
(Toolkit :: Find Toolbar, defect, P2)
Toolkit
Find Toolbar
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha3
People
(Reporter: asaf, Assigned: asaf)
References
Details
Attachments
(2 files, 4 obsolete files)
13.41 KB,
patch
|
Details | Diff | Splinter Review | |
7.25 KB,
patch
|
Details | Diff | Splinter Review |
nsITypeAheadFind::find and nsITypeAheadFind::findAgain have an [in]aHasFocus argument which is supposed to be |true| if the find textfield is focused. When |false| is passed, find/findAgain would focus a text/textarea if a search result was found in there. I believe this is the wrong approach for at least two reasons: - UI-wise, we should never take focus out of chrome elements when (Shift)F3 is pressed. - Clients of this interface are not necessarily find-toolbars. I suggest removing this argument and check the focused DOM window instead.
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P2
Assignee | ||
Comment 1•18 years ago
|
||
Attachment #245380 -
Flags: review?(masayuki)
Assignee | ||
Comment 2•18 years ago
|
||
Attachment #245414 -
Flags: review?(gavin.sharp)
Assignee | ||
Updated•18 years ago
|
Flags: in-testsuite?
Comment 3•18 years ago
|
||
Comment on attachment 245380 [details] [diff] [review] v1 looks good. thank you for your work.
Attachment #245380 -
Flags: review?(masayuki) → review+
Comment 4•18 years ago
|
||
Without looking too closely at the patch, this is roughly the approach I took in my original patch to enable find-in-textfields. It lived on in the 1.8 branch, where I couldn't change the interface, so make sure you look at the code there and ways in which this behaves similarly or differently. (Things weren't done this way on the trunk because masayuki suggested the method on trunk was preferable.) The main difference here I see is that you (purposefully) don't ever change focus when finding in a window that doesn't have focus, instead of just not changing when the findbar has focus. I'm not sure whether this is correct or not. The way all this stuff feels to users is extremely subtle. Make sure to test as many scenarios as possible to see whether finding a match in a textfield and then immediately typing a few characters does the thing you'd expect.
Assignee | ||
Comment 5•18 years ago
|
||
masayuki: thanks for review. Peter: Your branch check checked the focused element by its id (FindFieldIsFocused or something like that) IIRC. As for the behavior, I don't think we should ever move the focus from chrome to content in this case (e.g. when pressing F3 when the location bar is focused).
Comment 6•18 years ago
|
||
(In reply to comment #5) > As for the behavior, I don't think we should ever move the focus from chrome to > content in this case (e.g. when pressing F3 when the location bar is focused). I don't think that's right. If the Match Case checkbox in the find bar has focus, for example, I think you _should_ change focus. In general, it seems like you should change focus unless the focus is on a text-entry chrome element, not just any chrome element.
Assignee | ||
Comment 7•18 years ago
|
||
(In reply to comment #6) > (In reply to comment #5) > > As for the behavior, I don't think we should ever move the focus from chrome to > > content in this case (e.g. when pressing F3 when the location bar is focused). > > I don't think that's right. If the Match Case checkbox in the find bar has > focus, for example, I think you _should_ change focus. In general, it seems > like you should change focus unless the focus is on a text-entry chrome > element, not just any chrome element. > I cannot see why. If you focused the match-case checkbox on purpose, there's no sense in taking focus out of it. With that said, I do see this as a special case, and the solution might be to focus back the find textfield whenever the checkbox is ticked (Actually, that might be the right thing event without the behavior change introduced here).
Assignee | ||
Comment 8•18 years ago
|
||
Attachment #245380 -
Attachment is obsolete: true
Attachment #251592 -
Flags: review?(mconnor)
Assignee | ||
Comment 9•18 years ago
|
||
Comment on attachment 251592 [details] [diff] [review] updated to tip (just for the findbar.xml changes).
Attachment #251592 -
Flags: review?(mconnor) → review?(gavin.sharp)
Updated•18 years ago
|
Attachment #251592 -
Flags: review?(gavin.sharp) → review+
Comment 10•18 years ago
|
||
Unit test that also verifies that the findbar doesn't steal focus from chrome, as discussed on IRC.
Assignee: mano → gavin.sharp
Attachment #245414 -
Attachment is obsolete: true
Attachment #253443 -
Flags: review?
Attachment #245414 -
Flags: review?(gavin.sharp)
Updated•18 years ago
|
Attachment #253443 -
Flags: review? → review?(mano)
Updated•18 years ago
|
Assignee: gavin.sharp → mano
Status: ASSIGNED → NEW
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Target Milestone: Firefox 3 alpha1 → Firefox 3 alpha2
Assignee | ||
Comment 11•18 years ago
|
||
Comment on attachment 253443 [details]
unit test
var textbox = document.getElementById("textbox");
textbox.focus();
gFindBar.close();
gFindBar.onFindAgainCommand(false);
ASSERT(textbox.hasAttribute("focused"),
"Focus was stolen from a chrome element");
The order here is wrong, I think. closing the findbar may change focus, thus the textbox should be focused right before onFindAgain is called.
Attachment #253443 -
Flags: review?(mano) → review-
Comment 12•18 years ago
|
||
(In reply to comment #11) > The order here is wrong, I think. closing the findbar may change focus, thus > the textbox should be focused right before onFindAgain is called. It only changes focus if something in the binding itself is focused, so this isn't actually a problem, right? The test gives me the expected results, with and without your patch.
Assignee | ||
Comment 13•18 years ago
|
||
Comment on attachment 253443 [details]
unit test
you win :)
Attachment #253443 -
Flags: review- → review+
Assignee | ||
Comment 14•17 years ago
|
||
mozilla/toolkit/components/typeaheadfind/public/nsITypeAheadFind.idl 1.10 mozilla/toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp 1.31 mozilla/toolkit/components/typeaheadfind/src/nsTypeAheadFind.h 1.10 mozilla/toolkit/content/widgets/findbar.xml 1.8
Attachment #251592 -
Attachment is obsolete: true
Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: [a3]
Target Milestone: Firefox 3 alpha2 → Firefox 3
Assignee | ||
Updated•17 years ago
|
Whiteboard: [a3]
Target Milestone: Firefox 3 → Firefox 3 alpha3
Assignee | ||
Comment 15•17 years ago
|
||
Attachment #253443 -
Attachment is obsolete: true
Assignee | ||
Comment 16•17 years ago
|
||
mozilla/toolkit/content/tests/chrome/Makefile.in 1.2 mozilla/toolkit/content/tests/chrome/bug360437_window.xul initial revision: 1.1 mozilla/toolkit/content/tests/chrome/test_bug360437.xul initial revision: 1.1
Flags: in-testsuite? → in-testsuite+
Updated•16 years ago
|
Product: Firefox → Toolkit
You need to log in
before you can comment on or make changes to this bug.
Description
•