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

Balloon is appearing in all aria-label tags #119

Closed
JoelNieto opened this issue Jun 22, 2019 · 9 comments
Closed

Balloon is appearing in all aria-label tags #119

JoelNieto opened this issue Jun 22, 2019 · 9 comments
Labels

Comments

@JoelNieto
Copy link

I'm using the CDN version and the tooltip isn't working well. It appears in all elements with aria-label tags.
Ironically, it doesn't show with those with data-balloon-pos tags.
This is your css code, why is this?
[aria-label]:not([data-balloon-pos]):before { bottom: 100%; left: 50%; transform: translate(-50%, var(--balloon-move)); transform-origin: top; }

@kazzkiq kazzkiq added the bug label Jun 25, 2019
@tonda13
Copy link

tonda13 commented Jun 30, 2019

This is causing problems also with DataTables because they used aria-labels e.g. as sorting arrows.

@silverwind
Copy link

silverwind commented Jun 30, 2019

A dedicated attribute like data-balloon-text would solve this. It may be possible to use it with the CSS var function to get a fallback to aria-label when absent:

content: var(attr(data-baloon-text), attr(aria-label));

@kazzkiq
Copy link
Owner

kazzkiq commented Jul 1, 2019

The issue here is that a custom attribute would harm accessibility as discussed in #19.

aria-label is the preferable attribute for this purpose.

@JoelNieto that code snippet you linked has the sole purpose of enabling tooltips even when not using data-balloon-pos so if you want a default tooltip you don't have to type data-balloon-pos="up" everytime. But since this "feature" is leading to all aria-label to show popups, I think we can remove it.

@silverwind
Copy link

Ideally, I think the user should be able to choose if they need accessibility (aria-label) or compatibilty (data-baloon-text), so every use case can be covered.

@silverwind
Copy link

silverwind commented Jul 1, 2019

I do have a working branch with working with a var() fallback, but it just occured to me that it will not solve the issues above because those users might not be in control of other libraries adding aria-label, so wrong tooltips will still show.

Ultimately, it can only be solved by switching to a dedicated data-attribute. Users concerned with accessibilty have to manually add aria-label where appropriate.

@kazzkiq
Copy link
Owner

kazzkiq commented Jul 1, 2019

Another solution can be forcing the use of data-balloon-pos in order top show the tooltip.

So this would not show a tooltip:

<button aria-label="My Text Here!">No tooltip!</button>

While this would trigger Balloon.css and show the tooltip:

<button aria-label="My Text Here!" data-balloon-pos="up">Yay, tooltip!</button>

This way we prevent all aria-labels elements from triggering unwanted tooltips but also keep the use of aria-label.

@silverwind
Copy link

That would be an option yes, assuming the user is in control of all tags that should show tooltips. Would be a breaking change thought, so be sure to bump the major version for this :)

@ingro
Copy link

ingro commented Jul 3, 2019

Hello, is there a workaround to this issue? I used balloon.css for a widget and when I integrated it in our site tooltips start appearing all around.

@kazzkiq kazzkiq closed this as completed in 1845555 Jul 3, 2019
@kazzkiq
Copy link
Owner

kazzkiq commented Jul 3, 2019

Just pushed v1.0.1 with a fix to this issue.

Now Balloon.css only activates when elements have both aria-label and data-balloon-pos attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants