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

.btn-link has border-color: transparent why? #27220

Closed
719media opened this issue Sep 13, 2018 · 4 comments
Closed

.btn-link has border-color: transparent why? #27220

719media opened this issue Sep 13, 2018 · 4 comments

Comments

@719media
Copy link
Contributor

719media commented Sep 13, 2018

I've looked for the reasoning behind adding border-color: transparent to the :hover and :focus states of .btn-link

@include hover {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
border-color: transparent;
}
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
border-color: transparent;
box-shadow: none;
}

but cannot find the reason for this. I came across this when trying to utilize some custom border styles on .btn-link and had the borders turn transparent on hover because of this.

Blame points to the change being introduced in #22951, but it isn't obvious to me the reasoning behind this rule. I propose removing it.

@tfevan
Copy link

tfevan commented Sep 16, 2018

Hi,
Thanks for asking. Read this, I think you'll get your answer.
https://stackoverflow.com/questions/9612758/add-a-css-border-on-hover-without-moving-the-element

@mdo
Copy link
Member

mdo commented Sep 16, 2018

Because .btn-link is a modifier of .btn, you need both classes on the element. The .btn-link makes it transparent instead of removing the border outright to prevent any potential shifting (not likely these days with our box-sizing) and maintain some consistency.

I could go either way with it. I don’t know for sure if there are any situations where we absolutely need the border to stick around. We’d have to test more.

@MartijnCuppens
Copy link
Member

.btn already sets border-color: transparent;, so indeed this can be removed. The same with background-color: transparent; which was added in #27003. See R14-R15:

.btn {
display: inline-block;
font-weight: $btn-font-weight;
color: $body-color;
text-align: center;
vertical-align: middle;
user-select: none;
background-color: transparent;
border: $btn-border-width solid transparent;

@andresgalante
Copy link
Collaborator

We kinda did the same here #27003

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