Closed
Bug 296469
Opened 19 years ago
Closed 18 years ago
Mozilla doesn't implement document.hasFocus like IE
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jdperlow, Assigned: pkasting)
References
Details
(Whiteboard: see also bug 296471)
Attachments
(2 files, 3 obsolete files)
562 bytes,
application/octet-stream
|
Details | |
3.91 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
IE implements document.hasFocus which provides a reliable way to determine
whether any element in the browser window has focus. Mozilla should have this
too. Some browser applications will behave differently based on whether the page
has focus.
Reproducible: Always
I'm working on a new product that will have a lot of usage. This functionality
is essential to it working well. Would be very happy to see this in FF1.1 so
that the Firefox experience can be at least as good as the IE experience.
Flags: blocking-aviary1.1?
Comment 2•19 years ago
|
||
This was taken from
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/hasfocus.asp
which exemplifies the use of document.hasFocus. It works on IE but doesn't work
for me.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511
Firefox/1.0.4
Comment 3•19 years ago
|
||
This is the same file with a very simple modification that replaces
document.hasFocus. Something a little more robust might be necessary for a
decent workaround, but this works.
That workaround doesn't work if there are nested iframes in the page. If a
nested iframe has focus, the workaround doesn't return the right value. In IE,
document.hasFocus() returns true if anything nested in the document has focus,
including content inside iframes.
Updated•19 years ago
|
Flags: blocking-aviary1.1? → blocking-aviary1.1-
Assignee | ||
Updated•19 years ago
|
Assignee: general → pkasting
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•19 years ago
|
Whiteboard: see also bug 296471
Assignee | ||
Comment 5•18 years ago
|
||
This seems to do the right thing as far as I can tell. Testcase files to be attached shortly.
Attachment #224139 -
Flags: superreview?(bzbarsky)
Attachment #224139 -
Flags: review?(bryner)
Assignee | ||
Comment 6•18 years ago
|
||
Unzip this .tgz file somewhere. test.html is a simple test based on the test already attached to this bug. test1.html and test2.html are more complex tests that we get the proper behavior with nested iframes.
In all cases, mousing over the "mouse over me" text should display a message iff that document or any children have focus.
Attachment #185720 -
Attachment is obsolete: true
Attachment #185723 -
Attachment is obsolete: true
Comment 7•18 years ago
|
||
I'd really prefer that someone more familiar with focus than I looked at this... but in any case, you need to change the IID of the interface and please add at the end, not in the middle?
Assignee | ||
Comment 8•18 years ago
|
||
OK, I can change it. The reason I didn't change it was because the last couple of additions to that file hadn't changed it, but maybe I was looking in the wrong place or something.
Assignee | ||
Comment 9•18 years ago
|
||
Address bzbarsky's comments.
Attachment #224139 -
Attachment is obsolete: true
Attachment #224142 -
Flags: superreview?(bzbarsky)
Attachment #224142 -
Flags: review?(bryner)
Attachment #224139 -
Flags: superreview?(bzbarsky)
Attachment #224139 -
Flags: review?(bryner)
Assignee | ||
Comment 10•18 years ago
|
||
This patch is included (in a slightly modified form) inside the patch I just attached to bug 337631, with the same reviewers.
Blocks: 296471
Comment 11•18 years ago
|
||
Comment on attachment 224142 [details] [diff] [review]
patch v2
removing this review since the patch is folded into bug 337631
Attachment #224142 -
Flags: review?(bryner)
Assignee | ||
Comment 12•18 years ago
|
||
Comment on attachment 224142 [details] [diff] [review]
patch v2
In that case I'll remove the SR request as well.
Attachment #224142 -
Flags: superreview?(bzbarsky)
Assignee | ||
Comment 13•18 years ago
|
||
FIXED by the commit of bug 337631 to the trunk.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•