Skip to content

Commit 4bdef08

Browse files
fix(fxa-settings): prevent CJK button labels breaking one character per line
Flex-shrink on settings row and modal CTA buttons was squeezing Japanese, Chinese, and Korean labels to a single character per line. Keep button text on one line and let paired modal actions wrap as a group when space is tight. Use child mx-2 margins for modal button spacing instead of gap-2 to avoid doubled horizontal spacing that caused premature wrapping. Fixes #18683
1 parent 0a260de commit 4bdef08

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

packages/fxa-react/styles/ctas.css

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
/* Max-height is a likely temp "hack" for .spinner until it's converted to TW */
5656
/* font-color is also a hack until all buttons are TWified */
5757
.cta-xl {
58-
@apply flex-1 font-bold text-base p-4 rounded-md;
58+
/* grow without shrinking — prevents CJK labels breaking one character per line */
59+
@apply grow shrink-0 basis-0 font-bold text-base p-4 rounded-md;
5960
}
6061

6162
.cta-caution {
@@ -202,3 +203,21 @@
202203
}
203204
}
204205
}
206+
207+
@layer utilities {
208+
/*
209+
* Flex children default to flex-shrink: 1, which squeezes CJK button labels
210+
* to one character per line in settings rows and modals. Higher specificity
211+
* than the flex-1 utility ensures shrink-0 wins when both are present.
212+
*/
213+
button.cta-neutral,
214+
a.cta-neutral,
215+
button.cta-primary,
216+
a.cta-primary,
217+
button.cta-caution,
218+
a.cta-caution,
219+
button.cta-primary-cms,
220+
a.cta-primary-cms {
221+
@apply shrink-0 whitespace-nowrap;
222+
}
223+
}

packages/fxa-settings/src/components/Settings/Modal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const Modal = ({
9898
{children}
9999

100100
{hasButtons && (
101-
<div className="flex justify-center mx-auto mt-6 max-w-64">
101+
<div className="flex flex-wrap justify-center mx-auto mt-6 max-w-64">
102102
{hasCancelButton && (
103103
<FtlMsg id="modal-cancel-button">
104104
<button

packages/fxa-settings/src/components/Settings/SubRow/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ const PasskeyDeleteModal = ({
441441
using a different way.
442442
</p>
443443
</FtlMsg>
444-
<div className="flex justify-center mx-2 mt-6">
444+
<div className="flex flex-wrap justify-center mx-2 mt-6">
445445
<FtlMsg id="passkey-delete-modal-cancel-button">
446446
<button
447447
className="cta-neutral mx-2 flex-1 cta-xl"

packages/fxa-settings/src/styles/unit-row.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
&-actions {
1717
@apply w-full items-baseline mt-2;
18+
19+
a[class*='cta-'],
20+
button[class*='cta-'] {
21+
@apply shrink-0 whitespace-nowrap;
22+
}
1823
}
1924

2025
&-hr {

0 commit comments

Comments
 (0)