Skip to content

Commit

Permalink
Add contain strict for absolutely positioned elements which specify a…
Browse files Browse the repository at this point in the history
…ll (#506)

coordinates and dimensions (top/left/width/height or top/left/bottom/right)
  • Loading branch information
krassowski authored Jan 3, 2023
1 parent abfd491 commit 578b0a3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/widgets/src/accordionlayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ namespace Private {
): HTMLElement {
const title = renderer.createSectionTitle(data);
title.style.position = 'absolute';
title.style.contain = 'strict';
title.setAttribute('aria-label', `${data.label} Section`);
title.setAttribute('aria-expanded', expanded ? 'true' : 'false');
title.setAttribute('aria-controls', data.owner.id);
Expand Down
1 change: 1 addition & 0 deletions packages/widgets/src/docklayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ export class DockLayout extends Layout {
// Initialize the handle layout behavior.
let style = handle.style;
style.position = 'absolute';
style.contain = 'strict';
style.top = '0';
style.left = '0';
style.width = '0';
Expand Down
1 change: 1 addition & 0 deletions packages/widgets/src/dockpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ export namespace DockPanel {
this.node.classList.add('lm-DockPanel-overlay');
this.node.classList.add('lm-mod-hidden');
this.node.style.position = 'absolute';
this.node.style.contain = 'strict';
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/widgets/src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,12 @@ export class LayoutItem implements IDisposable {
*
* #### Notes
* The widget will be set to absolute positioning.
* The widget will use strict CSS containment.
*/
constructor(widget: Widget) {
this.widget = widget;
this.widget.node.style.position = 'absolute';
this.widget.node.style.contain = 'strict';
}

/**
Expand All @@ -647,6 +649,7 @@ export class LayoutItem implements IDisposable {
style.left = '';
style.width = '';
style.height = '';
style.contain = '';
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/widgets/src/splitlayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,7 @@ namespace Private {
): HTMLDivElement {
let handle = renderer.createHandle();
handle.style.position = 'absolute';
handle.style.contain = 'strict';
return handle;
}

Expand Down

0 comments on commit 578b0a3

Please sign in to comment.