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

Add variable to set blur for form :focus box shadows #31940

Closed
samwilliscreative opened this issue Oct 20, 2020 · 4 comments
Closed

Add variable to set blur for form :focus box shadows #31940

samwilliscreative opened this issue Oct 20, 2020 · 4 comments

Comments

@samwilliscreative
Copy link
Contributor

samwilliscreative commented Oct 20, 2020

I am trying to style my buttons and forms using v5, but running into issues with setting my focus styles. This is due to the way box shadow variables are built up;

$input-btn-focus-width:         .25rem !default;
$input-btn-focus-color-opacity: .25 !default;
$input-btn-focus-color:         rgba($component-active-bg, $input-btn-focus-color-opacity) !default;
$input-btn-focus-box-shadow:    0 0 0 $input-btn-focus-width $input-btn-focus-color !default;

As you can see, the blur value for the $input-btn-focus-box-shadow variable is explicitly set to 0. This is fine in this instance as I can manually re-declare this variable with my own prop;

$input-btn-focus-box-shadow:    0 0 $custom-blur $input-btn-focus-width $input-btn-focus-color;

However, there are issues when it comes to validation. The problem is that the .form-control class that includes the validation state selector mixin explicitly sets the box-shadow, meaning there is no way for me to overwrite the property using variables:

bootstrap\scss\mixins\_forms.scss line 60

&:focus {
    border-color: $color;
    box-shadow: 0 0 0 $input-focus-width rgba($color, $input-btn-focus-color-opacity);
}

I am therefore asking that a $input-btn-focus-blur variable be added so that the mixin can still work as intended, whilst giving users the ability to blur if they wish. Thanks.

@mdo
Copy link
Member

mdo commented Jan 14, 2021

For now, going to pass on this. Our goal is to keep focus styles consistent and obvious. Adding a blur makes them look like default box-shadows IMO.

@mdo mdo closed this as completed Jan 14, 2021
@samwilliscreative
Copy link
Contributor Author

For now, going to pass on this. Our goal is to keep focus styles consistent and obvious. Adding a blur makes them look like default box-shadows IMO.

Sure, that makes sense, but for those developers that need to customise Bootstrap, the additional variable would allow us to set a consistent value for the blur.

You could even initialise the variable with a value of 0 so as to keep the base Bootstrap styles that you mention.

@mdo
Copy link
Member

mdo commented Jan 18, 2021

Feel like opening a PR by chance? I wouldn't mind reviewing and thinking about it again.

@samwilliscreative
Copy link
Contributor Author

@mdo I have opened a PR here: #33031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants