-
-
Notifications
You must be signed in to change notification settings - Fork 78.8k
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
Handle non-empty whitespace textContent in Tooltip trigger #36588
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was really helpful to use the String.prototype.trim()
method to handle white space, it's the right thing to do.
Thank you, @nwalters512 . As handy it may be, please try to add some tests to support your PR, and I would suggest making this change easy to applied everywhere. So probably, the best place is the TemplateFactory |
@GeoSot I can try adding some tests! Re: your recommendation to make this change in |
I added a test case in e2900e9. I verified that it failed before this change and now passes. |
@nwalters51 I have understood your suggestion and the cause of the issue. Many thanks for your help here |
If a Tooltip trigger has non-empty
textContent
that consists solely of whitespace, Bootstrap will remove thetitle
but won't add anaria-label
with the contents oftitle
. Here's a reproduction of this: https://jsfiddle.net/nwalters512/7y8edzxr/7/. This is a poor experience for folks using screen readers, as they won't have any accessible label for the trigger.This PR changes the JS to check the falseyness of
textContent.trim()
instead oftextContent
directly.