Skip to content

Commit

Permalink
Fix: If keepfocus is false, don’t lock focus inside popup even if e…
Browse files Browse the repository at this point in the history
…lement is in focus
  • Loading branch information
vladimirsiljkovic committed Dec 11, 2018
1 parent cc245c4 commit 45aab88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jquery.popupoverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,15 @@
// Keep keyboard focus inside of popup
$(document).on('keydown', function(event) {
if(visiblePopupsArray.length && event.which == 9) {

// If tab or shift-tab pressed
var elementId = visiblePopupsArray[visiblePopupsArray.length - 1];
var el = document.getElementById(elementId);
var options = $(el).data('popupoptions');

// If the last opened popup doesn't have `keepfocus` option, ignore the rest and don't lock the focus inside of popup.
if (!options.keepfocus) {
return;
}

// Get list of all children elements in given object
var popupItems = $(el).find('*');
Expand Down

0 comments on commit 45aab88

Please sign in to comment.