MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / checkButtonGroupWrap

Method checkButtonGroupWrap

core/src/components/alert/alert.tsx:746–774  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

744 }
745
746 private checkButtonGroupWrap() {
747 /**
748 * Defer the layout read out of the ResizeObserver callback so we don't
749 * force synchronous layout and avoid "ResizeObserver loop" warnings when
750 * applying the vertical-layout class itself triggers another resize.
751 */
752 raf(() => {
753 /**
754 * Bail if the alert was disconnected after this raf was queued.
755 * `buttonGroupEl` persists across disconnect so the observer can be
756 * re-attached on reconnect; the observer reference is the disconnect
757 * sentinel.
758 */
759 if (!this.buttonGroupResizeObserver) {
760 return;
761 }
762 const groupEl = this.buttonGroupEl;
763 if (!groupEl) {
764 return;
765 }
766 const buttons = Array.from(groupEl.querySelectorAll<HTMLElement>('.alert-button'));
767 if (buttons.length < 2) {
768 this.isButtonGroupWrapped = false;
769 return;
770 }
771 const firstTop = buttons[0].offsetTop;
772 this.isButtonGroupWrapped = buttons.some((btn) => btn.offsetTop !== firstTop);
773 });
774 }
775
776 private renderAlertButtons() {
777 const buttons = this.processedButtons;

Callers 2

buttonsChangedMethod · 0.95

Calls 2

rafFunction · 0.90
fromMethod · 0.80

Tested by

no test coverage detected