Closed
Bug 303730
Opened 20 years ago
Closed 19 years ago
<textarea>s in other tabs mess up focus in current 'tab'
Categories
(SeaMonkey :: Tabbed Browser, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: chpe, Assigned: chpe)
References
()
Details
(Keywords: fixed1.8.1)
Attachments
(2 files, 2 obsolete files)
|
5.29 KB,
patch
|
mconnor
:
approval1.8.1+
|
Details | Diff | Splinter Review |
|
3.54 KB,
patch
|
Details | Diff | Splinter Review |
(Picking component from other focus stealing bugs like bug 124750, but this
might belong elsewhere.)
In my embedding application (Epiphany), which uses GtkMozEmbed for its tabs, I
use nsIWebBrowserFocus (::Activate
[http://lxr.mozilla.org/seamonkey/source/embedding/browser/webBrowser/nsWebBrowser.cpp#1738]
and ::Deactivate
[http://lxr.mozilla.org/seamonkey/source/embedding/browser/webBrowser/nsWebBrowser.cpp#1810]),
to control focus, to work around the broken gtkmozembed focus (bug 210373 and
bug 244664). ::Activate/Deactivate primarily set the root focus controller's
'active' state.
However, I've found that a <textarea> in an inactive tab (with inactive focus
controller) can still take the focus away from elements in the active tab (with
active focus controller). The focus is taken away from the focused element in
the active tab but does not actually end up in the inactive tab (i.e. what I
type does not go to the other tab, so this is probably not a security problem).
This only happens for <textarea> with .focus and .select; <input> works as
expected (tested with type="text" and type="button" at least).
Steps to reproduce:
0) Load the testcases test-textarea.html and test-textarea-select.html from
http://www.gnome.org/~chpe/testcases/ in Epiphany.
1) Open the links in a new tab and switch to that tab
2) Try to input text in the textarea or the text input field.
Result:
The <textarea> in the background tab prevents continued input by taking focus away.
Analysis:
Comparing nsHTMLInputElement::SetFocus
[http://lxr.mozilla.org/seamonkey/source/content/html/content/src/nsHTMLInputElement.cpp#1053]
with nsHTMLTextAreaElement::SecFocus
[http://lxr.mozilla.org/seamonkey/source/content/html/content/src/nsHTMLTextAreaElement.cpp#232],
I find that the nsHTMLInputElement's code contains something that the
nsHTMLTextArea's code does not: it tests the focus controller's state, and only
sets the focused window and element if it's inactive and then returns early.
Copying that code to nsHTMLTextArea::SetFocus and ::Select fixes this bug; patch
coming up.
| Assignee | ||
Comment 1•20 years ago
|
||
Code copied from nsHTMLInputElement: Test the focus controller's "active" state
and return early if it's inactive.
Comment 2•20 years ago
|
||
The test case also appears to steal focus from FireFox's location entry.
Comment 3•20 years ago
|
||
This reminds me of bug 124750. But the fix for that bug didn't fix it for you?
| Assignee | ||
Comment 4•20 years ago
|
||
(In reply to comment #3)
> This reminds me of bug 124750. But the fix for that bug didn't fix it for you?
No, the fix for bug 124750 doesn't fix this. I tested this bug with Epiphany
HEAD using gecko from firefox 1.0.6 and trunk as backend and while both contain
that fix, this bug is still present.
| Assignee | ||
Comment 5•20 years ago
|
||
Comment on attachment 191835 [details] [diff] [review]
proposed fix
Let's request r/sr... (I hope I picked the right ones)
Attachment #191835 -
Flags: superreview?(peterv)
Attachment #191835 -
Flags: review?(jst)
Comment 6•20 years ago
|
||
Comment on attachment 191835 [details] [diff] [review]
proposed fix
Looks good to me, but I'd prefer someone who knows focus to take a look.
Attachment #191835 -
Flags: superreview?(peterv) → superreview?(bryner)
Updated•20 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 7•20 years ago
|
||
the is the same patch as attachment 191835 [details] [diff] [review], rediff'd against trunk (no code
changes, only context changes).
| Assignee | ||
Updated•20 years ago
|
Attachment #191835 -
Flags: superreview?(bryner)
Attachment #191835 -
Flags: review?(jst)
| Assignee | ||
Updated•20 years ago
|
Attachment #200072 -
Flags: superreview?(bryner)
Attachment #200072 -
Flags: review?(jst)
Updated•19 years ago
|
Attachment #200072 -
Flags: superreview?(bryner) → superreview+
Comment 8•19 years ago
|
||
Johnny, could you review the patch? Thanks.
Comment 9•19 years ago
|
||
Comment on attachment 200072 [details] [diff] [review]
trunk patch
Sorry for not getting to this any earlier, this got lost in my sometimes unmanageable amount of bugmail and requests...
+ nsCOMPtr<nsPIDOMWindow> win =
+ do_QueryInterface(doc->GetScriptGlobalObject());
+ if (win) {
"win" could now be a raw nsPIDOMWindow pointer and you get the window by calling doc->GetWindow(), no need to QI any more (and GetWindow() will return the outer window, which you want, not the inner window that you get by QI'ing the script global object).
r=jst with that changed (in both places).
Attachment #200072 -
Flags: review?(jst) → review+
| Assignee | ||
Comment 10•19 years ago
|
||
Attachment #191835 -
Attachment is obsolete: true
Attachment #200072 -
Attachment is obsolete: true
Comment 11•19 years ago
|
||
chpe, I can check the patch in later today, if you want to (unless someone beats me on doing it).
| Assignee | ||
Comment 12•19 years ago
|
||
(In reply to comment #11)
> chpe, I can check the patch in later today, if you want to (unless someone
> beats me on doing it).
Since I don't have cvs commit access, that would be appreciated. Thanks!
Updated•19 years ago
|
Assignee: nobody → chpe
Comment 13•19 years ago
|
||
Checking in nsHTMLTextAreaElement.cpp;
/cvsroot/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp,v <-- nsHT
MLTextAreaElement.cpp
new revision: 1.184; previous revision: 1.183
done
Checked into trunk. Thanks for the patch.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
We probably should get this on the 1.8.1 branch for chpe's sake.
Attachment #228967 -
Flags: approval1.8.1?
Comment 15•19 years ago
|
||
Let's let this bake on the trunk for a couple of days; we're a little nervous about playing with focus this late in the game.
bryner: you sr'd this patch, what's the risk factor in taking this, potential-regression-wise?
Comment 16•19 years ago
|
||
(In reply to comment #15)
> Let's let this bake on the trunk for a couple of days; we're a little nervous
> about playing with focus this late in the game.
>
> bryner: you sr'd this patch, what's the risk factor in taking this,
> potential-regression-wise?
>
very low risk, this is just syncing textarea with input
Comment 17•19 years ago
|
||
Comment on attachment 228967 [details] [diff] [review]
updated patch for reviewer's comment
a=mconnor on behalf of drivers for checkin by Wednesday, July 19th
Attachment #228967 -
Flags: approval1.8.1? → approval1.8.1+
Comment 18•19 years ago
|
||
This is what I'm going to check in in the 1.8.1 branch.
Comment 19•19 years ago
|
||
Checking in nsHTMLTextAreaElement.cpp;
/cvsroot/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp,v <-- nsHT
MLTextAreaElement.cpp
new revision: 1.171.4.4; previous revision: 1.171.4.3
done
Fixed on the 1.8.1 branch.
Keywords: fixed1.8.1
Updated•17 years ago
|
Product: Core → SeaMonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•