jquery-confirm icon indicating copy to clipboard operation
jquery-confirm copied to clipboard

Tabbing out of confirm dialogs

Open jdomigon opened this issue 3 years ago • 0 comments

jquery-confirm version: v3.3.4

I'm submitting a ... (check one with "x") [X] bug report [ ] feature request [ ] support request

Current behavior: When a confirm dialog is showing, it blocks mouse events so that it's not possible to select components in the screen behind. Nevertheless, it is possible to "tab out" ot the confirm dialog and select the underlying components using the tab key.

Expected behavior: Tabbing out of components inside the confirm dialog should be prevented.

Steps to reproduce: Tab out of a confirm dialog and navigate underlying focusable components using the tab key.

Other information: Plugin jquery ui dialog prevents tabbing out of its modal dialogs by capturing keydown events: Related code:

// Prevent tabbing out of dialogs
if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
	return;
}
var tabbables = this.uiDialog.find( ":tabbable" ),
	first = tabbables.filter( ":first" ),
	last = tabbables.filter( ":last" );

if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
		!event.shiftKey ) {
	this._delay( function() {
		first.trigger( "focus" );
	} );
	event.preventDefault();
} else if ( ( event.target === first[ 0 ] ||
		event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
	this._delay( function() {
		last.trigger( "focus" );
	} );
	event.preventDefault();
}

jdomigon avatar Nov 26 '20 20:11 jdomigon