Skip to content

Commit f9631e9

Browse files
Make preventTabbingOutsideDialog more easily overridable (#15460)
- Add comment about functionality - Expose application shell classes for easier reference Fixes #15417
1 parent 1cd33b5 commit f9631e9

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

packages/core/src/browser/dialogs.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,17 @@ export abstract class AbstractDialog<T> extends BaseWidget {
241241
this.toDisposeOnDetach.push(DialogOverlayService.get().push(this));
242242
}
243243

244-
protected preventTabbingOutsideDialog(): Disposable {
245-
const nonInertSiblings = Array.from(this.node.ownerDocument.body.children).filter(child => child !== this.node && !(child.hasAttribute('inert')));
246-
nonInertSiblings.forEach(child => child.setAttribute('inert', ''));
247-
return Disposable.create(() => nonInertSiblings.forEach(child => child.removeAttribute('inert')));
244+
/**
245+
* This prevents tabbing outside the dialog by marking elements as inert, i.e., non-clickable and non-focussable.
246+
*
247+
* @param elements the elements for which we disable tabbing. By default all elements within the body element are considered.
248+
* Please note that this may also include other popups such as the suggestion overlay, the notification center or quick picks.
249+
* @returns a disposable that will restore the previous tabbing behavior
250+
*/
251+
protected preventTabbingOutsideDialog(elements = Array.from(this.node.ownerDocument.body.children)): Disposable {
252+
const nonInertElements = elements.filter(child => child !== this.node && !(child.hasAttribute('inert')));
253+
nonInertElements.forEach(child => child.setAttribute('inert', ''));
254+
return Disposable.create(() => nonInertElements.forEach(child => child.removeAttribute('inert')));
248255
}
249256

250257
protected handleEscape(event: KeyboardEvent): boolean | void {

packages/core/src/browser/shell/application-shell.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ import { PreviewableWidget } from '../widgets/previewable-widget';
4747
import { WindowService } from '../window/window-service';
4848

4949
/** The class name added to ApplicationShell instances. */
50-
const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
50+
export const APPLICATION_SHELL_CLASS = 'theia-ApplicationShell';
5151
/** The class name added to the main and bottom area panels. */
52-
const MAIN_BOTTOM_AREA_CLASS = 'theia-app-centers';
52+
export const MAIN_BOTTOM_AREA_CLASS = 'theia-app-centers';
5353
/** Status bar entry identifier for the bottom panel toggle button. */
54-
const BOTTOM_PANEL_TOGGLE_ID = 'bottom-panel-toggle';
54+
export const BOTTOM_PANEL_TOGGLE_ID = 'bottom-panel-toggle';
5555
/** The class name added to the main area panel. */
56-
const MAIN_AREA_CLASS = 'theia-app-main';
56+
export const MAIN_AREA_CLASS = 'theia-app-main';
5757
/** The class name added to the bottom area panel. */
58-
const BOTTOM_AREA_CLASS = 'theia-app-bottom';
58+
export const BOTTOM_AREA_CLASS = 'theia-app-bottom';
5959

6060
export type ApplicationShellLayoutVersion =
6161
/** layout versioning is introduced, unversioned layout are not compatible */

0 commit comments

Comments
 (0)