diff --git a/packages/css/src/components/tabs/tabs.scss b/packages/css/src/components/tabs/tabs.scss
index 97b153156a..f9df81959f 100644
--- a/packages/css/src/components/tabs/tabs.scss
+++ b/packages/css/src/components/tabs/tabs.scss
@@ -28,6 +28,7 @@
.ams-tabs__button {
color: var(--ams-tabs-button-color);
cursor: var(--ams-tabs-button-cursor);
+ display: grid;
font-family: var(--ams-tabs-button-font-family);
font-size: var(--ams-tabs-button-font-size);
font-weight: var(--ams-tabs-button-font-weight);
@@ -62,3 +63,17 @@
}
}
}
+
+.ams-tabs__button-label,
+.ams-tabs__button-label-hidden {
+ grid-area: 1 / 1;
+}
+
+// This hidden label is used to prevent a layout shift when the mega menu is opened
+// and the button text becomes bold.
+.ams-tabs__button-label-hidden {
+ font-weight: var(--ams-tabs-button-selected-font-weight);
+ pointer-events: none;
+ user-select: none;
+ visibility: hidden;
+}
diff --git a/packages/react/src/Tabs/TabsButton.tsx b/packages/react/src/Tabs/TabsButton.tsx
index 9c41b9d214..d0f495bdd0 100644
--- a/packages/react/src/Tabs/TabsButton.tsx
+++ b/packages/react/src/Tabs/TabsButton.tsx
@@ -33,7 +33,12 @@ export const TabsButton = forwardRef(
role="tab"
tabIndex={activeTab === tab ? 0 : -1}
>
- {children}
+
+ {children}
+
+
+ {children}
+
)
},