Skip to content

Commit

Permalink
MDL-67513 forum: View conversations while fullscreen grading
Browse files Browse the repository at this point in the history
Before this change when a modal was shown and an element on the page
was fullscreen the modal would be created behind it.

This change ensures that the modal will be inside an element that is
fullscreen so that it will be correctly displayed.
  • Loading branch information
NeillM committed Nov 12, 2020
1 parent 76df82c commit 5242533
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 16 deletions.
2 changes: 2 additions & 0 deletions lib/amd/build/fullscreen.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/amd/build/fullscreen.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/modal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/amd/build/modal.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/amd/build/modal_backdrop.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/modal_backdrop.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions lib/amd/src/fullscreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Detects if an element is fullscreen.
*
* @module core/fullscreen
* @class fullscreen
* @package core
* @copyright 2020 University of Nottingham
* @author Neill Magill <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Gets the element that is fullscreen or null if no element is fullscreen.
*
* @returns {HTMLElement}
*/
export const getElement = () => {
let element = null;
if (document.fullscreenElement) {
element = document.fullscreenElement;
} else if (document.mozFullscreenElement) {
// Fallback for older Firefox.
element = document.mozFullscreenElement;
} else if (document.msFullscreenElement) {
// Fallback for Edge and IE.
element = document.msFullscreenElement;
} else if (document.webkitFullscreenElement) {
// Fallback for Chrome, Edge and Safari.
element = document.webkitFullscreenElement;
}

return element;
};
Loading

0 comments on commit 5242533

Please sign in to comment.