Opened 10 years ago

Closed 10 years ago

#8577 closed defect (fixed)

Bug in dijit._base.focus._onFocusNode method

Reported by: AndrewBird Owned by: bill
Priority: high Milestone: 1.3
Component: Dijit Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

_onFocusNode method inside dijit._base.focus:

		if(node.nodeType == 9){
			// Ignore focus events on the document itself.  This is here so that
			// (for example) clicking the up/down arrows of a spinner
			//  (which don't get focus) won't cause that widget to blur. (FF issue)
			return;
		}

		if(node.nodeType == 9){
			// We focused on (the body of) the document itself, either the main document
			// or an iframe
			var iframe = dijit.getDocumentWindow(node).frameElement;
			if(!iframe){
				// Ignore focus events on main document.  This is specifically here
				// so that clicking the up/down arrows of a spinner (which don't get focus)
				// won't cause that widget to blur.
				return;
			}

			node = iframe;
		}

Note that there are two conditionals for "node.nodeType == 9". If the nodeType is ever ==9, the second conditional will not be hit due to the return.

Thanks, Andy

Change History (3)

comment:1 Changed 10 years ago by bill

Component: GeneralDijit
Milestone: tbd1.3
Owner: changed from anonymous to bill

Actually Doug pointed this out to me the second time. There's actually a bigger issue in that tabbing into an editor on FF3 doesn't work right.

This is fallout from my changes for for #6519.

This is also related to #7979, need to make sure whatever I do doesn't reintroduce that problem.

comment:2 Changed 10 years ago by bill

Oops I meant "a few days ago" not "the second time".

comment:3 Changed 10 years ago by bill

Resolution: fixed
Status: newclosed

(In [16554]) [15197] and [15692] had problems. They didn't differentiate between clicks/focus on an Editor's iframe's document, and on the "main" document where dojo is loaded, if the main document itself was an iframe.

Adding explicit code to register that click/focus on the the Editor's iframe's document are to be reported as click/focus on the Editor's <iframe> node.

BTW this fix also masks differences between browsers as to where the focus event is reported:

  • FF: the event was reported on the document, but mysteriously the Editor's iframe's document and the main window's document are the same,or at least they appear to be the same in a console.log().
  • IE: the <iframe> node
  • Safari: the iframe's <body> node

Refs #6519, #7979, fixes #8577. !strict

Note: See TracTickets for help on using tickets.