Skip to content

When setting both $input-focus-box-shadow and $input-box-shadow to none, Bootstrap generates invalid CSS. #41381

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

Closed
3 tasks done
morganwahl opened this issue Apr 15, 2025 · 2 comments · Fixed by #41469
Closed
3 tasks done

Comments

@morganwahl
Copy link

morganwahl commented Apr 15, 2025

Prerequisites

Describe the issue

If you set these Bootstrap Sass variables like so:

$input-focus-box-shadow: none;
$input-box-shadow: none;

You end up with this invalid CSS:

.form-control:focus {
  ...
  box-shadow: none, none;
}

This isn't a problem for the appearance of the page, but it would be nice to generate valid CSS, so that automated tools that look for invalid CSS aren't raising errors.

I see the box-shadow mixin does issue a warning when there are multiple box shadows and one of them is "none". Could it also have some logic to just output a single "none" when all the shadow values are "none"?

Reduced test cases

Include this before the Bootstrap variables.

$input-focus-box-shadow: none;
$input-box-shadow: none;
<input class="form-control"></input>

Put the focus in the input.

What operating system(s) are you seeing the problem on?

Linux

What browser(s) are you seeing the problem on?

No response

What version of Bootstrap are you using?

v5.3.1

@github-project-automation github-project-automation bot moved this to To do in v5.3.6 Apr 16, 2025
@julien-deramond julien-deramond moved this from To do to To analyze in v5.3.6 Apr 16, 2025
@mdo
Copy link
Member

mdo commented Apr 22, 2025

Near as I can tell this doesn't happen for us? Demo of v5.3.5 at https://stackblitz.com/edit/stackblitz-starters-tmn8jqwf?file=src%2Fstyles.scss.

Image

@mdo mdo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2025
@github-project-automation github-project-automation bot moved this from To analyze to Done in v5.3.6 Apr 22, 2025
@mdo mdo removed this from v5.3.6 Apr 22, 2025
@julien-deramond
Copy link
Member

In addition to setting the two Sass variables to none, we also need to set $enable-shadows: true, as shown in this example:
https://stackblitz.com/edit/stackblitz-starters-k7bg44bd?file=src%2Fstyles.scss.

This results in the following output:

Image

Reopening the issue accordingly.

@github-project-automation github-project-automation bot moved this to To do in v5.3.7 May 13, 2025
@julien-deramond julien-deramond removed the status in v5.3.7 May 13, 2025
@julien-deramond julien-deramond moved this to To do in v5.3.7 May 14, 2025
@julien-deramond julien-deramond moved this from To do to Needs review in v5.3.7 May 14, 2025
@github-project-automation github-project-automation bot moved this from Needs review to Done in v5.3.7 May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants