Skip to content

Commit

Permalink
refactor(alert, autocomplete, combobox, dialog, dropdown, input-date-…
Browse files Browse the repository at this point in the history
…picker, modal, notice, popover, sheet, tooltip): avoid clearing `transitionEl` ref nodes (#11497)

**Related Issue:** #11093

## Summary

Updates transition element `ref` callbacks to avoid clearing the
reference. This should preserve the context of existing ref logic.
  • Loading branch information
jcfranco authored Feb 25, 2025
1 parent ae626be commit c568454
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/calcite-components/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ export class Alert extends LitElement implements OpenCloseComponent {
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ export class Autocomplete
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,11 @@ export class Combobox
}

private setContainerEl(el: HTMLDivElement): void {
if (el) {
this.resizeObserver?.observe(el);
if (!el) {
return;
}

this.resizeObserver?.observe(el);
this.listContainerEl = el;
this.transitionEl = el;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/calcite-components/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ export class Dialog extends LitElement implements OpenCloseComponent {
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
this.setupInteractions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,11 @@ export class Dropdown
}

private setScrollerAndTransitionEl(el: HTMLDivElement): void {
if (el) {
this.resizeObserver?.observe(el);
if (!el) {
return;
}

this.resizeObserver?.observe(el);
this.scrollerEl = el;
this.transitionEl = el;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ export class InputDatePicker
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/calcite-components/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ export class Modal extends LitElement implements OpenCloseComponent {
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/calcite-components/src/components/notice/notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ export class Notice extends LitElement implements OpenCloseComponent {
}

private setTransitionEl(el: HTMLElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ export class Popover extends LitElement implements FloatingUIComponent, OpenClos
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/calcite-components/src/components/sheet/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ export class Sheet extends LitElement implements OpenCloseComponent {
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ export class Tooltip extends LitElement implements FloatingUIComponent, OpenClos
}

private setTransitionEl(el: HTMLDivElement): void {
if (!el) {
return;
}

this.transitionEl = el;
}

Expand Down

0 comments on commit c568454

Please sign in to comment.