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

Links badges without href breaks color #31279

Closed
inwardmovement opened this issue Jul 11, 2020 · 4 comments
Closed

Links badges without href breaks color #31279

inwardmovement opened this issue Jul 11, 2020 · 4 comments

Comments

@inwardmovement
Copy link
Contributor

inwardmovement commented Jul 11, 2020

Links badges should be usable without href attribute, to be used like buttons. For now _reboot.scss breaks badge color:

a:not([href]) {
  color: inherit;
  [...]
}

Suggested fixes:

  • _reboot.scss:
a:not([href]):not(.badge)
  • provide support for using .badge-* classes on a <button> element, having the same styling as using them on a <a> element (no .btn styling).

  • add preventDefault() on anchor tags with href, like for link buttons

@rohit2sharma95
Copy link
Collaborator

rohit2sharma95 commented Jul 13, 2020

@inwardmovement Why are you removing href attribute from anchor tag? 🤔
Though, you can also use .text-white and .text-body classes to prevent this behavior.

@inwardmovement
Copy link
Contributor Author

@rohit2sharma95 because I am using a link badge as a footnote ref toggling a popover showing the footnote text. See this in action here:
image

If I leave href then an undesirable scroll to top happens.
Indeed for now I use this fix (I'd rather not use utility classes):

.footnote-badge {
  color: #fff !important; // fix badge link with no href
}

As another suggested fix we could use preventDefault() like for link buttons. But I feel this should be a Bootstrap "native" behavior, just like link buttons.

@bbugh
Copy link

bbugh commented Jul 15, 2020

I just ran into this as well, sort of, in the case where we wanted a <button> to be a link badge. @inwardmovement use case is more appropriate for a button as well, but the badges don't work for buttons in BS5. Supporting button tags with the link badges like btn classes seems like a good solution.

@ffoodd
Copy link
Member

ffoodd commented Aug 18, 2020

Duplicate of #31391 and ##30531 — resolved with #30830.

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

5 participants