Skip to content

Fix tooltip on replaced elements#86

Open
laurentbardin wants to merge 2 commits intoknadh:masterfrom
laurentbardin:fix-tooltip-on-replaced-elements
Open

Fix tooltip on replaced elements#86
laurentbardin wants to merge 2 commits intoknadh:masterfrom
laurentbardin:fix-tooltip-on-replaced-elements

Conversation

@laurentbardin
Copy link

Using ::before and ::after to manage tooltips can't work on [https://developer.mozilla.org/en-US/docs/Glossary/Replaced_elements](replaced elements), the most common of those being <img>.

We should skip those elements in order to preserve their title attribute so that the default browser behaviour still works and the text be displayed.

Alternatively, we could still add the data-tooltip or aria-label attribute (or both), and simply skip the removal of the title attribute.

Tooltips use `::before` and `::after`, which cannot work on replaced
elements, the most common of which is `<img>`. We skip those elements
when initialising the tooltips so that their `title` attribute is not
removed and it can still be displayed by the browser when hovering over
them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments