SEBWIN-607, #480, #499: Fixed access to potentially uninitialized DOM in accessibility JavaScript code.

This commit is contained in:
Damian Büchel 2022-11-29 13:55:19 +01:00
parent f948463685
commit 3bd786543d
2 changed files with 2 additions and 0 deletions

View file

@ -512,6 +512,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
var javascript = @"
if (typeof __SEB_focusElement === 'undefined') {
__SEB_focusElement = function (forward) {
if (!document.body) { return; }
var items = [].map
.call(document.body.querySelectorAll(['input', 'select', 'a[href]', 'textarea', 'button', '[tabindex]']), function(el, i) { return { el, i } })
.filter(function(e) { return e.el.tabIndex >= 0 && !e.el.disabled && e.el.offsetParent; })

View file

@ -508,6 +508,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
var javascript = @"
if (typeof __SEB_focusElement === 'undefined') {
__SEB_focusElement = function (forward) {
if (!document.body) { return; }
var items = [].map
.call(document.body.querySelectorAll(['input', 'select', 'a[href]', 'textarea', 'button', '[tabindex]']), function(el, i) { return { el, i } })
.filter(function(e) { return e.el.tabIndex >= 0 && !e.el.disabled && e.el.offsetParent; })