Skip to main content

Search and Top Navigation

#13649 closed bug (fixed)

Opened July 14, 2015 09:13PM UTC

Closed July 17, 2015 03:02PM UTC

Last modified July 17, 2015 03:02PM UTC

Modal dialog removes all document focusin handlers in _destroyOverlay

Reported by: RandScullard Owned by:
Priority: minor Milestone: 1.12.0
Component: ui.dialog Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:
Description

The dialog widget uses this._on to add a focusin event handler at the document level in the _createOverlay function:

this._on( this.document, {
	focusin: function( event ) {
		if ( isOpening ) {
			return;
		}

		if ( !this._allowInteraction( event ) ) {
			event.preventDefault();
			this._trackingInstances()[ 0 ]._focusTabbable();
		}
	}
});

However, it then uses unbind to remove the handler in the _destroyOverlay function:

this.document
	.unbind( "focusin" )
	.removeData( "ui-dialog-overlays" );

As a result, it removes all focusin handlers at the document level, rather than just its own. It seems that it should use this._off instead:

this._off( this.document, "focusin" );
this.document
	.removeData( "ui-dialog-overlays" );

Here is a reduced test case that demonstrates the problem: https://jsfiddle.net/eu4ua6kj/2/

Attachments (0)
Change History (2)

Changed July 17, 2015 03:02PM UTC by Scott González comment:1

resolution: → fixed
status: newclosed

Dialog: Fix removal of event listener for modal dialogs

Fixes #13649

Changeset: 62446d957efb69cd53015919edf71501fcbd2599

Changed July 17, 2015 03:02PM UTC by scottgonzalez comment:2

milestone: none1.12.0