Skip to content

Commit

Permalink
fix(overlay): incorrect change check for interactiveElements property
Browse files Browse the repository at this point in the history
fix(overlay): zIndex register must come first as used by other managers
fix(overlay): applyLock must be called for all lock related properties
fix(overlay): resized callback is called on overlay close. Make sure that sizing info is not applied
  • Loading branch information
goremikins committed Oct 14, 2021
1 parent 64a1d46 commit d1da5b6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/elements/src/overlay/elements/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export class Overlay extends ResponsiveElement {
attribute: false,
hasChanged: (newVal: HTMLElement[], oldVal?: HTMLElement[]): boolean => {
if (!oldVal || newVal.length !== oldVal.length) {
return false;
return true;
}
return newVal.some(el => !oldVal.includes(el));
}
Expand Down Expand Up @@ -793,14 +793,14 @@ export class Overlay extends ResponsiveElement {

/* !!! Obligatory managers cannot be removed here, as this function is synchronous and animations must be taken into account !!! */
if (opening) {
/* Obligatory managers */
// must come first as used by other managers
zIndexRegister(this);

viewportRegister(this);

closeRegister(this, () => {
this.setOpened(false);
});

zIndexRegister(this);
}

const enablingFocusManagement = (opening && !this.noFocusManagement) || (opened && changedProperties.get('noFocusManagement'));
Expand All @@ -812,7 +812,7 @@ export class Overlay extends ResponsiveElement {
focusableDeregister(this);
}

if (opening || changedProperties.has('noInteractionLock')) {
if (opening || changedProperties.has('noInteractionLock') || changedProperties.has('lockPositionTarget') || changedProperties.has('interactiveElements')) {
applyLock();
}

Expand All @@ -834,9 +834,9 @@ export class Overlay extends ResponsiveElement {
* @returns {void}
*/
private removeMainRegisters (): void {
zIndexDeregister(this);
viewportDeregister(this);
closeDeregister(this);
zIndexDeregister(this);
focusableDeregister(this);
}

Expand Down Expand Up @@ -1641,6 +1641,10 @@ export class Overlay extends ResponsiveElement {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public resizedCallback (size: ElementSize): void {
this.resizedThrottler.schedule(() => {
if (!this.opened && this._fullyOpened === OpenedState.CLOSED) {
// Do nothing on last resized callback
return;
}
this.setResizeSizingInfo();
this.fitNonThrottled();

Expand Down

0 comments on commit d1da5b6

Please sign in to comment.