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

feat: log invalid CSS selector with tooltip-id #1026

Merged
merged 1 commit into from
May 19, 2023
Merged

feat: log invalid CSS selector with tooltip-id #1026

merged 1 commit into from
May 19, 2023

Conversation

dtamai
Copy link
Contributor

@dtamai dtamai commented May 19, 2023

Context

There is this warning for when the CSS selector is invalid in TooltipController.

It was useful for me when I troubleshooting an issue with a tooltip but it would print only [react-tooltip] "undefined" is not a valid CSS selector, but the issue was that the CSS selector contained a \r\n that made it invalid, not that it was undefined.

The warning is not printing the invalid selector when it is using the data-tooltip-id attribute. This PR proposes to print the selector variable that covers both selectors - anchor and id.

This produces the warning below (there is a line break in the selector):

image


🎉 And thanks for maintaining this package! The recent addition of the try/catch block that prints the warning means that only the tooltip breaks, not the whole page.

The data-tooltip-id may be invalid too, so we can log that value for
better troubleshooting.
@danielbarion
Copy link
Member

@dtamai thanks for the fix!

@danielbarion danielbarion merged commit 5a7e360 into ReactTooltip:master May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants