Fix buttons :focus state styles#27890
Conversation
Buttons :hover and :focus state shares styles. Buttons :focus text color on 'a.btn' is now consistent with others '.btn'.
|
bootstrap/scss/mixins/_buttons.scss Lines 14 to 16 in 21e39ce to: bootstrap/scss/mixins/_buttons.scss Lines 19 to 21 in 21e39ce Maybe we should add this here: Line 25 in 21e39ce (wait a sec before applying any changes, would like to have a second opinion from @mdo or @ysds) |
|
@MartijnCuppens I agree bootstrap/scss/mixins/_buttons.scss Lines 19 to 21 in 21e39ce One idea come to my mind: If there should be always available bootstrap/scss/mixins/_hover.scss Lines 16 to 21 in 21e39ce to: @mixin hover-focus {
&:hover,
&:focus,
&.focus
{
@content;
}
} etc. The others should be changed accordingly ( |
|
I’m against adding a |
|
@mdo So @MartijnCuppens is right - So I'm going to prepare new commit where styles will be copied to |
So shared styles with hover were copy to focus definition. Rather then using `hover-focus` mixin which do not contain `.focus`.
|
I'm not really convinced I would go for adding What do you think? |
1) colorAgreed. Add 2) backgroundSo I tested the case when is default then button bootstrap/scss/mixins/_buttons.scss Lines 18 to 19 in 39b7686 3) borderA case where someone would add a border to link is really marginal (almost crazy? :). For demonstration it behaves as expected: Summary:I propose to add &:focus,
&.focus {
color: color-yiq($hover-background);
@include gradient-bg($background);
...
}What do you think? |
|
Hello everybody who is in charge here :]. So what? @MartijnCuppens please :] Just summarize this: This change is only in one file bootstrap/scss/mixins/_buttons.scss Lines 19 to 21 in 21e39ce adding these lines of code: &:focus,
&.focus {
color: color-yiq($hover-background);
@include gradient-bg($hover-background);
border-color: $hover-border;
// Avoid using mixin so we can pass custom focus shadow properly(here is diff of to fix issues specified above in my last issuecomment ie color, background and border style. The intent is override customized user setup for link styles (basic IMHO This can not hurt anyone. |
|
@MartijnCuppens: does this need to be backported to v4? |
|
Yeah, this fixes issues with focus styles. Good call @XhmikosR |
* Fix buttons :focus state styles Buttons :hover and :focus state shares styles. Buttons :focus text color on 'a.btn' is now consistent with others '.btn'. * `:focus` styles should be in sync with `.focus`. So shared styles with hover were copy to focus definition. Rather then using `hover-focus` mixin which do not contain `.focus`.
* Fix buttons :focus state styles Buttons :hover and :focus state shares styles. Buttons :focus text color on 'a.btn' is now consistent with others '.btn'. * `:focus` styles should be in sync with `.focus`. So shared styles with hover were copy to focus definition. Rather then using `hover-focus` mixin which do not contain `.focus`.




Small change which fix two issues:
1] Buttons :hover and :focus state shares styles now.
As you expect and as it is in BS3,
:focusstate is same as:hoverstate only extended by outline.Before:


.btnwith:focusappears as normal button state with 'outline':After:
.btnwith:focuslooks like:hoverstate with 'outline':2] Buttons :focus text color on 'a.btn' is now consistent with others '.btn'.
If you somewhere define specific color (e.g.
$danger) for:focusstate on<a>then ...Before: This specific color is presented in


:focusstate on.btnmade from<a>:After: Specific color is overridden with right
.btncolor: