From c7f1f68c38a02bc137a33217e5d146d05f16b56f Mon Sep 17 00:00:00 2001 From: Samuel Or Date: Thu, 10 Jul 2025 12:56:48 -0700 Subject: [PATCH 1/2] fix: S2 Prevented Tooltip text overflowing by default --- packages/@react-spectrum/s2/src/Tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/s2/src/Tooltip.tsx b/packages/@react-spectrum/s2/src/Tooltip.tsx index 84295a4277c..6a7817f1e63 100644 --- a/packages/@react-spectrum/s2/src/Tooltip.tsx +++ b/packages/@react-spectrum/s2/src/Tooltip.tsx @@ -167,7 +167,7 @@ export const Tooltip = forwardRef(function Tooltip(props: TooltipProps, ref: DOM placement={placement} shouldFlip={shouldFlip} ref={tooltipRef} - style={UNSAFE_style} + style={{overflowWrap: 'break-word', ...UNSAFE_style}} className={renderProps => UNSAFE_className + tooltip({...renderProps, colorScheme})}> {renderProps => ( <> From 49d6f99db97591f34a2954f0a822f9ef41d91c99 Mon Sep 17 00:00:00 2001 From: Samuel Or Date: Fri, 18 Jul 2025 11:04:11 -0700 Subject: [PATCH 2/2] fix: Added overflowWrap property to style macros --- packages/@react-spectrum/s2/src/Tooltip.tsx | 5 ++++- packages/@react-spectrum/s2/style/properties.json | 8 +++++++- packages/@react-spectrum/s2/style/spectrum-theme.ts | 3 ++- .../@react-spectrum/style-macro-s1/src/spectrum-theme.ts | 3 ++- .../src/s1-to-s2/src/codemods/shared/unsafeStyle.ts | 1 + 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/@react-spectrum/s2/src/Tooltip.tsx b/packages/@react-spectrum/s2/src/Tooltip.tsx index 6a7817f1e63..9e0959725d3 100644 --- a/packages/@react-spectrum/s2/src/Tooltip.tsx +++ b/packages/@react-spectrum/s2/src/Tooltip.tsx @@ -101,6 +101,9 @@ const tooltip = style UNSAFE_className + tooltip({...renderProps, colorScheme})}> {renderProps => ( <> diff --git a/packages/@react-spectrum/s2/style/properties.json b/packages/@react-spectrum/s2/style/properties.json index 0ed62c71dec..a87f6dfae6f 100644 --- a/packages/@react-spectrum/s2/style/properties.json +++ b/packages/@react-spectrum/s2/style/properties.json @@ -165,7 +165,8 @@ "textWrap": "__W", "touchAction": "__X", "translate": "__Y", - "wordBreak": "__Z" + "wordBreak": "__Z", + "overflowWrap": "__0" }, "values": { "--iconPrimary": { @@ -2150,6 +2151,11 @@ "break-all": "a", "keep-all": "b", "normal": "c" + }, + "overflowWrap": { + "normal": "a", + "anywhere": "b", + "break-word": "c" } }, "conditions": { diff --git a/packages/@react-spectrum/s2/style/spectrum-theme.ts b/packages/@react-spectrum/s2/style/spectrum-theme.ts index dff40e34a01..5d6fc225b11 100644 --- a/packages/@react-spectrum/s2/style/spectrum-theme.ts +++ b/packages/@react-spectrum/s2/style/spectrum-theme.ts @@ -795,7 +795,8 @@ export const style = createTheme({ hyphens: ['none', 'manual', 'auto'] as const, whiteSpace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] as const, textWrap: ['wrap', 'nowrap', 'balance', 'pretty'] as const, - wordBreak: ['normal', 'break-all', 'keep-all'] as const, // also overflowWrap?? + wordBreak: ['normal', 'break-all', 'keep-all'] as const, + overflowWrap: ['normal', 'anywhere', 'break-word'] as const, boxDecorationBreak: ['slice', 'clone'] as const, // effects diff --git a/packages/@react-spectrum/style-macro-s1/src/spectrum-theme.ts b/packages/@react-spectrum/style-macro-s1/src/spectrum-theme.ts index 2617d0ca528..7b8b1073fe3 100644 --- a/packages/@react-spectrum/style-macro-s1/src/spectrum-theme.ts +++ b/packages/@react-spectrum/style-macro-s1/src/spectrum-theme.ts @@ -703,7 +703,8 @@ export const style = createTheme({ hyphens: ['none', 'manual', 'auto'] as const, whiteSpace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] as const, textWrap: ['wrap', 'nowrap', 'balance', 'pretty'] as const, - wordBreak: ['normal', 'break-all', 'keep-all'] as const, // also overflowWrap?? + wordBreak: ['normal', 'break-all', 'keep-all'] as const, + overflowWrap: ['normal', 'anywhere', 'break-word'] as const, boxDecorationBreak: ['slice', 'clone'] as const, // effects diff --git a/packages/dev/codemods/src/s1-to-s2/src/codemods/shared/unsafeStyle.ts b/packages/dev/codemods/src/s1-to-s2/src/codemods/shared/unsafeStyle.ts index 8be657d42b0..1803d44f2d1 100644 --- a/packages/dev/codemods/src/s1-to-s2/src/codemods/shared/unsafeStyle.ts +++ b/packages/dev/codemods/src/s1-to-s2/src/codemods/shared/unsafeStyle.ts @@ -365,6 +365,7 @@ function handleProperty(element: string, property: string, value: t.ObjectProper case 'whiteSpace': case 'textWrap': case 'wordBreak': + case 'overflowWrap': case 'boxDecorationBreak': case 'forcedColorAdjust': case 'backgroundPosition':