Skip to content
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

Allow strings for EuiToolTip children #2292

Closed
smith opened this issue Sep 5, 2019 · 6 comments
Closed

Allow strings for EuiToolTip children #2292

smith opened this issue Sep 5, 2019 · 6 comments

Comments

@smith
Copy link
Contributor

smith commented Sep 5, 2019

The type for the children prop of EuiTooltip is React.ReactElement<any>. It expects this because it does a React.cloneElement to create the anchor.

Because it is of this type and not React.ReactNode, you cannot pass a string as children to a tooltip, so:

<EuiToolTip>{someValue}</EuiToolTip>

has to become:

<EuiToolTip><>{someValue}</></EuiTooltip>

It would be nice if we were more flexible and allowed any React.ReactNode as children.

@thompsongl
Copy link
Contributor

I agree that React.ReactElement<any> is likely too strict. We do, however, need to consider a11y, so tab focus and keyboard navigation/interaction are a consideration and bare text is likely not an option. EUI could make assumptions about what to do with a string (e.g., wrap it in an EuiLink), but it'd have to be discussed.

@smith
Copy link
Contributor Author

smith commented Sep 5, 2019

I don't think we need to sacrifice the developer experience for accessibility; we can have both. I started to just open a PR to fix it but realized there were design considerations that were needed. Thanks for looking!

@cchaos
Copy link
Contributor

cchaos commented Mar 18, 2020

@smith Do you still hav that PR handy, we can certainly help with the design considerations.

@smith
Copy link
Contributor Author

smith commented Mar 18, 2020

@cchaos No I checked on the branch and there's nothing there, so I don't think I made any changes back then. Thanks for looking!

@cchaos cchaos changed the title Allow strings for ToolTip children Allow strings for EuiToolTip children Mar 27, 2020
@cchaos
Copy link
Contributor

cchaos commented Sep 18, 2020

Related #4040 & #2027

@cchaos
Copy link
Contributor

cchaos commented Sep 18, 2020

Closing in favor of a Meta discussion around EuiTooltip flexibility which I've included a link to this discussion but needs to be a part of a greater effort.

@cchaos cchaos closed this as completed Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants