Skip to content
Snippets Groups Projects
Commit 8f997685 authored by LucasC's avatar LucasC
Browse files

XWIKI-18194: Exiting FullScreen from the gallery macro scrolls the page in a...

XWIKI-18194: Exiting FullScreen from the gallery macro scrolls the page in a random location (#3937)

* Focused the maximizeToggle button even when using a shortcut, so that it stays in the screen view.
* Added a comment to explain the changes

(cherry picked from commit 2ed742eb)
parent 46e72234
No related tags found
No related merge requests found
......@@ -121,6 +121,11 @@ XWiki.Gallery = Class.create({
"${escapetool.javascript($services.localization.render('core.widgets.gallery.minimize'))}";
this.container.toggleClassName('maximized');
$(document.documentElement).toggleClassName('maximized');
// When a keyboard shortcut is used, the gallery is not focused by default. In order to keep the screen at the
// level of the gallery even when minimizing, we need to make sure it's always focused.
// Without this forced focus, minimizing the gallery by pressing the `Escape` key will
// unexpectedly send the user to the top of the page.
this.maximizeToggle.focus();
},
show : function(index) {
if (index < 0 || index >= this.images.length || index == this.index) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment