Browse Source

lity : fix le focus dans la mediabox quand elle est ouverte, meme si on en ressort par la barre de nav du navigateur

cf https://github.com/jsor/lity/pull/258
pull/1/head
Cerdic 6 months ago
parent
commit
7c1f1cc970
  1. 5
      lib/lity/lity.js
  2. 1
      lity/js/lity.mediabox.js

5
lib/lity/lity.js

@ -34,6 +34,7 @@
inline: inlineHandler,
iframe: iframeHandler
},
forceFocusInside: false,
template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'
};
@ -269,6 +270,10 @@
focusableElements.get(0).focus();
e.preventDefault();
}
if (focusedIndex === -1 && instance.options().forceFocusInside) {
focusableElements.get(0).focus();
e.preventDefault();
}
}
function resize() {

1
lity/js/lity.mediabox.js

@ -8,6 +8,7 @@
var litySpip = {
nameSpace: 'mediabox',
config: {
forceFocusInside: true,
},
strings: {
},

Loading…
Cancel
Save