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

Only show dotted underline on abbr[title] if @media (supports: hover) media query #62

Open
coliff opened this issue Jun 20, 2022 · 5 comments

Comments

@coliff
Copy link

coliff commented Jun 20, 2022

Currently we have this:

abbr[title] {
  text-decoration: underline dotted;
}

This means that abbr tags have dotted underline even on iPhone and iPad where its impossible to see the title as browser doesn't support hover - even with a mouse connected.

I propose to change this to:

@media (hover: none) {
  abbr[title] {
    text-decoration: none;
  }
}

@media (hover: hover) {
  abbr[title] {
    text-decoration: underline dotted;
  }
}
@sindresorhus
Copy link
Owner

Makes sense to be, but I will leave it open for a while to gather feedback.

It should use this media query: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover

@atjn
Copy link
Contributor

atjn commented Aug 9, 2024

The official HTML spec calls for text decoration even if the browser does not support hover. I am not sure if that is a bug in the spec, or if there is a reason they chose to do it that way: https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3

@coliff if you are up for it, I think you should open an issue on the spec to figure out which solution is best: https://github.com/whatwg/html/issues

Edit: It just occured to me that the spec probably wants all browsers to display the title, even mobile ones. So that is why it never removes the decoration.

@jssteinberg
Copy link

I'm a fan of removing default styling of abbr[title] since it doesn't have across device functionality by default. If a site makes use of abbr[title] without defining the abbreviation visible in text, then it's normally implemented as a more usable functionality (i.e. styled and otherwise implemented more intuitively for the user). Don't know if I was able to make sense of my argumentation...

@atjn
Copy link
Contributor

atjn commented Aug 23, 2024

@jssteinberg If you want to remove the default styling, I think you should open a separate issue for that.

This specific issue is fixed with the removal of the reset in #86 - we no longer force the dotted underline in browsers that don't support it.

@jssteinberg
Copy link

Well I'm not sure, but my thought is that when a browser shows the dotted lines for abbr[title] is could give a false sense of universal functionality for content authors. And I feel it's the logical across browser normalization, but is it the best solution... I kind of like that it's removed from this lib as well, hah

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

No branches or pull requests

4 participants