fix(overlays): only set inert for placementMode global

This commit is contained in:
Joren Broekema 2020-12-02 13:35:30 +01:00
parent 0f41bf20c2
commit 83359ac2b9
3 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/overlays': patch
---
Only set inert when placementMode is global, otherwise events are broken inside local overlay content

View file

@ -1013,7 +1013,7 @@ export class OverlayController extends EventTargetShim {
this._containFocusHandler = containFocus(this.contentNode); this._containFocusHandler = containFocus(this.contentNode);
this.__hasActiveTrapsKeyboardFocus = true; this.__hasActiveTrapsKeyboardFocus = true;
if (this.manager) { if (this.manager) {
this.manager.informTrapsKeyboardFocusGotEnabled(); this.manager.informTrapsKeyboardFocusGotEnabled(this.placementMode);
} }
} }

View file

@ -153,8 +153,11 @@ export class OverlaysManager {
}); });
} }
informTrapsKeyboardFocusGotEnabled() { /**
if (this.siblingsInert === false) { * @param {'local' | 'global' | undefined} placementMode
*/
informTrapsKeyboardFocusGotEnabled(placementMode) {
if (this.siblingsInert === false && placementMode === 'global') {
if (OverlaysManager.__globalRootNode) { if (OverlaysManager.__globalRootNode) {
setSiblingsInert(this.globalRootNode); setSiblingsInert(this.globalRootNode);
} }