Skip to content

fix: S2 Prevented Tooltip text overflowing by default #8527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

samuelo-ensemble
Copy link

Closes #8514

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Create a Tooltip with long non-breaking text

Before:

image

After:

image

🧢 Your Project:

@@ -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}}
Copy link
Member

@snowystinger snowystinger Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll want to add this style to the tooltip style (classname one line below is where that is used, it's a style macro), not to the inline style for the element

See https://react-spectrum.adobe.com/s2/index.html?path=/docs/style-macro--docs for more info on style macros

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that, but currently there isn't support there for overflowWrap in React Spectrum v3 and S2. Is this an addition we want to add support for here, and would that require additional documentation changes etc?

https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/s2/style/spectrum-theme.ts#L798

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, looks like the comment suggests we should add it

Comment on lines +169 to +170
"overflowWrap": "__0",
"--fs": "__1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"overflowWrap": "__0",
"--fs": "__1"
"--fs": "__0",
"overflowWrap": "__1"

@devongovett i think this has to be like this to keep it stable across versions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just swap the value as you suggested @snowystinger to be safe, and move on?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @devongovett typically generates this file with some script, so i do still want him to weigh in as i don't think it's meant to be manually updated

@snowystinger snowystinger added the waiting Waiting on Issue Author label Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting on Issue Author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip - Text Overflows
2 participants