Open Bug 131784 Opened 19 years ago Updated 3 years ago

missing iframe onfocus

Categories

(Core :: DOM: Events, defect, P5)

defect

Tracking

()

People

(Reporter: thiago, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: access, testcase, Whiteboard: INVALID?)

Attachments

(3 files, 3 obsolete files)

iframes has no onFocus event, and afaik it should have..

I don´t have an url for this, but its simple to test, just put an alert at the
iframe onFocus.
events
Assignee: jkeiser → joki
Status: UNCONFIRMED → NEW
Component: HTMLFrames → DOM Events
Ever confirmed: true
OS: Windows XP → All
QA Contact: amar → vladimire
Hardware: PC → All
Attached file testcase for onBlur and onFocus (obsolete) —
onBlur doesn't work too, even though both are specified in
http://www.mozilla.org/xpfe/xulref/iframe.html
Attaching a testcase for these and (commented out) all the others supported by
other browsers.
Attached file html testcase
Priority: -- → P3
Build ID: 2003021308
OS: Windows 2000 Server

This sort of works. Clicking inside the iframe doesn't trigger the events, but
clicking on the small grey border around the iframe first triggers the blur
event, and then triggers the focus event. Clicking somewhere else triggers only
the blur event.
I am developing an app where I have some elements of a form inside iframes, so
that they are reloaded when something else changes in the form. Problem is that
iframes participate in the "Tab-cycles-input-elements-of-forms". To solve this I
have an onfocus event on the iframe which when triggered puts the focus on the
first item inside the iframe. This works with IE, but not with Mozilla.
As mentioned in comment #4, clicking on the border surrounding an iframe will
trigger onfocus event handler. Also, if you give a padding to iframe, you'll
easily see that clicking in that padding area triggers the iframe's onfocus
event handler. Though the onfocus event for iframe will not be fired when
tabbing or shift-tabbing to it.

"This [onfocus] attribute may be used with the following elements: A, AREA,
LABEL, INPUT, SELECT, TEXTAREA, and BUTTON."
http://www.w3.org/TR/html401/interact/scripts.html#adef-onfocus
So, Mozilla does not have to support onfocus for iframe, even though it kinda
supports it, at least internally.
Same thing with Opera 7.x's "Show Active frame border setting
(Preferences.../Page Style): When you view framed pages, the currently active
frame will always be outlined."
Severity: major → normal
Attached file Iframed document (obsolete) —
Attachment #84514 - Attachment is obsolete: true
Attached file Main document of test page (obsolete) —
Load this document.
Then try clicking, tabbing, shift-tabbing, etc.
*** Bug 253498 has been marked as a duplicate of this bug. ***
Assignee: joki → events
Blocks: focusnav
*** Bug 321263 has been marked as a duplicate of this bug. ***
I agree that W3C recomendation to event focus in HTML documents may be used with the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON, but the same example "Main document of test page" works fine in IE. Doesn't necessary to expand the padding and click it to the iframe has focus.
Are there any idea to fix it and works fine in FF.
Best regards  
<HTML>
<HEAD>
<TITLE>TEST PAGE</TITLE>
<!-- no cache headers -->
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="-1" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY topmargin=0 leftmargin=0>
<IFRAME src='http://www.mypage.org/adsense.html' frameborder='0' width='300' height='50' onFocus='logClick()'></iframe>
<script type="text/javascript">
function logClick() {
    window.focus();
    bug = new Image();  
    bug.src = 'http://mypage.org/track.php?pg=' + escape(document.title);
}
</script>
</BODY>
</HTML>

Above javascript code wont work with mozilla, but it work with IE.. Whats wrong? Please help me..
Assignee: events → mats.palmgren
Keywords: access
QA Contact: vladimire → events
Attached file Iframed document
Attachment #151852 - Attachment is obsolete: true
Attachment #151853 - Attachment is obsolete: true
The behavior seems intentional:
http://mxr.mozilla.org/mozilla-central/source/dom/base/nsFocusManager.cpp#975
Assignee: matspal → nobody
Keywords: testcase
Whiteboard: INVALID?
Bulk priority change, per :mdaly
Priority: P3 → P5
You need to log in before you can comment on or make changes to this bug.