Skip to content

Commit

Permalink
fixes #10297 8.14-RC - A few areas where focus lock doesn't work prop…
Browse files Browse the repository at this point in the history
…erly
  • Loading branch information
madsrasmussen committed May 26, 2021
1 parent 630fa6a commit 74a42b3
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
var isLeftColumnAbove = false;
scope.editors = [];

/* we need to keep a count of open editors because the length of the editors array is first changed when animations are done
we do this because some infinite editors close more than one editor at the time and we get the wrong count from editors.length
because of the animation */
let editorCount = 0;

function addEditor(editor) {
editor.inFront = true;
editor.moveRight = true;
Expand Down Expand Up @@ -51,13 +56,16 @@

updateEditors(-1);

if(scope.editors.length === 1){
if(scope.editors.length === 1) {
if(isLeftColumnAbove){
$('#leftcolumn').addClass(aboveBackDropCssClass);
}

isLeftColumnAbove = false;
}

// when the last editor is closed remove the focus lock
if (editorCount === 0) {
// Remove the inert attribute from the #mainwrapper
focusLockService.removeInertAttribute();
}
Expand Down Expand Up @@ -105,16 +113,19 @@
}

evts.push(eventsService.on("appState.editors.open", function (name, args) {
editorCount = editorCount + 1;
addEditor(args.editor);
}));

evts.push(eventsService.on("appState.editors.close", function (name, args) {
// remove the closed editor
if (args && args.editor) {
editorCount = editorCount - 1;
removeEditor(args.editor);
}
// close all editors
if (args && !args.editor && args.editors.length === 0) {
editorCount = 0;
scope.editors = [];
}
}));
Expand Down

0 comments on commit 74a42b3

Please sign in to comment.