Closed
Bug 201996
Opened 22 years ago
Closed 22 years ago
Caret blinking in field, but focus is somewhere else
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
VERIFIED
FIXED
mozilla1.4beta
People
(Reporter: emaijala+moz, Assigned: bryner)
References
()
Details
(Keywords: access, regression, topembed+, Whiteboard: edt_a3,edt_d3)
Attachments
(3 files, 1 obsolete file)
984 bytes,
application/octet-stream
|
Details | |
53.87 KB,
patch
|
john
:
review+
jst
:
superreview+
sspitzer
:
approval1.4+
|
Details | Diff | Splinter Review |
40.73 KB,
patch
|
Details | Diff | Splinter Review |
Running trunk build 2003041208 on WinXP, although this has been a problem with a
few builds lately (I'm going to see if I find a time frame when this started).
I have a frameset where there is a menu on the left and a form on the right.
When the form is shown, the focus is set to the field using javascript. Caret
blinks happily in the field, but typing initiates find as you instead. A reduced
test case is available at http://atp.fi/~ere/frametest. I'll also attach it.
Press the form link on the left and try typing. If it works, click reload and
try again.
Reporter | ||
Comment 1•22 years ago
|
||
2003040209 works, 2003040308 fails. Brian, could your fix for bug 170811 have
caused this?
Assignee | ||
Comment 2•22 years ago
|
||
seems likely. and this has nothing to do with 'form manager'.
Assignee: dveditz → bryner
Component: Form Manager → Event Handling
Keywords: topembed
QA Contact: tpreston → desale
Target Milestone: --- → mozilla1.4beta
Reporter | ||
Comment 3•22 years ago
|
||
Oops, sorry. Should have thought about it a little more.
Assignee | ||
Comment 4•22 years ago
|
||
Can't reproduce on a recent Linux build. I tried reloading several times. I'll
check Mac and Windows next.
Assignee | ||
Comment 5•22 years ago
|
||
Can't reproduce on windows either :( (just-pulled cvs build, windows xp)
Reporter | ||
Comment 6•22 years ago
|
||
I can still reproduce, pulled today about 8 hours ago. I just click Form, type
something (works), click Reload and type something (doesn't).
Reporter | ||
Comment 7•22 years ago
|
||
This is the test case zipped.
Reporter | ||
Comment 8•22 years ago
|
||
Happens on Linux too using the latest nightly trunk build. Not every time, but
after a few reloads it always happens.
OS: Windows XP → All
Reporter | ||
Comment 9•22 years ago
|
||
About nsPresShell::CheckForFocus(). The latest version is missing an old check
to see if focusedWindow == domWindow (aOurWindow). Without this check it seems
to steal the focus from somewhere else. Now, the check makes me wonder if the
call to ourWin->Focus() is necessary at all. Everything I tried works fine
without it. Why focus a window that already has focus? The only reason I could
find for this is if focus controller just _thinks_ ourWindow has focus although
it doesn't. I don't know if such a case exists.
Anyway, having the check in place, or removing the Focus() call altogether,
makes the test case work perfectly and doesn't break tinderbox iframes (bug 170811).
Reporter | ||
Comment 10•22 years ago
|
||
This patch will restore the check in CheckForFocus() to focus the window only
if it's the active one. This avoids stealing the focus from someone else. I've
tested that scrolling after clicking a link in a tinderbox iframe still works
(bug 170811), my test case works and http login dialog (bug 191896) works.
Btw. the reason Focus() needs to be called is that when suppressed, only focus
controller is updated and the window doesn't really get the focus before this
call. This happens for example when creating the http auth login dialog.
Reporter | ||
Comment 11•22 years ago
|
||
The test case at http://atp.fi/~ere/frametest is improved a bit. Reloading it
with focus in the input field should definitely screw the focus without the patch.
Reporter | ||
Comment 12•22 years ago
|
||
Just for the record: the test case only works if it loads quickly enough, so to
test it should be copied to a local server or disk.
Comment 13•22 years ago
|
||
able to repro on mac/nscp, but for some reason cannot (so far) do so on camino.
(both trunk builds from today, 2003.04.18)
Hardware: PC → All
Comment 14•22 years ago
|
||
Discussed in edt bug triage. Plussing.
Comment 15•22 years ago
|
||
Comment on attachment 120961 [details] [diff] [review]
Proposed patch
This patch doesn't fix bug 203117 because it's the call to
aFocusController->SetFocusedWindow that's breaking that bug.
Reporter | ||
Comment 16•22 years ago
|
||
That problem is probably bug 201242 then.
Comment 17•22 years ago
|
||
Going from the "form" page to mozilla.org, back, forward, lost focus :-(
Assignee | ||
Comment 18•22 years ago
|
||
This patch fixes this bug, bug 200735, bug 203117, and bug 194104. Summary of
the changes:
- No longer require a frame to be present for all events. In particular, don't
require one for focus events. This ensures that focus events get through to
the focus controller even if we haven't reflowed the document yet.
- General cleanup and commenting in nsEventStateManager::PreHandleEvent(). I
fixed some cases where we should be reusing the event struct but aren't.
- In nsHTMLInputElement::SetFocus() and Select(), make sure to set the focused
window as well as the focused element if the focus controller is inactive.
This fixes setting latent focus to a text input inside an iframe.
- Fixed handling of certain conditions in PresShell's CheckForFocus(). The
previous behavior could be incorrect depending on whether the parent or child
document unsuppressed painting first.
- General cleanup in PresShell::HandleEvent() and HandleEventInternal().
Allowed focus events to go through with no frame, updated some comments,
normalized indentation.
Attachment #120961 -
Attachment is obsolete: true
Assignee | ||
Comment 19•22 years ago
|
||
Assignee | ||
Updated•22 years ago
|
Attachment #122184 -
Flags: superreview?(jst)
Attachment #122184 -
Flags: review?(jkeiser)
Comment 20•22 years ago
|
||
Comment on attachment 122185 [details] [diff] [review]
diff -w of the above, for easier reviewing
>@@ -2648,6 +2661,8 @@ static void CheckForFocus(nsPIDOMWindow*
>
> nsCOMPtr<nsIDocument> parentDoc;
> curDoc->GetParentDocument(getter_AddRefs(parentDoc));
>+ if (parentDoc == aDocument)
>+ return;
> curDoc = parentDoc;
> }
>
I can verify that this fixes bug 203117.
Reporter | ||
Comment 21•22 years ago
|
||
Thumbs up for bryner, the patch works great :)
Comment 22•22 years ago
|
||
nominating for 1.4beta, as this fixes a bunch of focus issues. in addition to
the ones mentioned in comment 18, bug 202180 also appears to be fixed.
Flags: blocking1.4b?
Comment 23•22 years ago
|
||
Comment on attachment 122184 [details] [diff] [review]
fix for a number of focus issues
sr=jst
Attachment #122184 -
Flags: superreview?(jst) → superreview+
Updated•22 years ago
|
Flags: blocking1.4b?
Flags: blocking1.4b-
Flags: blocking1.4?
Updated•22 years ago
|
Flags: blocking1.4? → blocking1.4+
Comment 24•22 years ago
|
||
Comment on attachment 122184 [details] [diff] [review]
fix for a number of focus issues
r=me if you fix the comment about sending a blur event to the window, which the
NS_GOTFOCUS code doesn't do. I am a little sad that this fix is restricted to
focus events, but it's a start and won't be hard to remove the restriction :)
Attachment #122184 -
Flags: review?(jkeiser) → review+
Assignee | ||
Comment 25•22 years ago
|
||
Comment on attachment 122184 [details] [diff] [review]
fix for a number of focus issues
drivers wants this for 1.4, right?
Attachment #122184 -
Flags: approval1.4?
Comment 26•22 years ago
|
||
Comment on attachment 122184 [details] [diff] [review]
fix for a number of focus issues
a=sspitzer, as this is a 1.4 blocker
Attachment #122184 -
Flags: approval1.4? → approval1.4+
Assignee | ||
Comment 27•22 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•