Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Nested import of bootstrap breaks form control validation #31223

Closed
ryleyb opened this issue Jul 2, 2020 · 2 comments
Closed

Nested import of bootstrap breaks form control validation #31223

ryleyb opened this issue Jul 2, 2020 · 2 comments

Comments

@ryleyb
Copy link

ryleyb commented Jul 2, 2020

I use bootstrap nested in a a selector like this:

#app {
  @import "~bootstrap/scss/bootstrap.scss";
}

In 4.3.1, form control validation produced this CSS for invalid-feedback:

.was-validated #app .form-control:invalid ~ .invalid-feedback,
.was-validated #app .form-control:invalid ~ .invalid-tooltip, 
#app .form-control.is-invalid ~ .invalid-feedback,
#app .form-control.is-invalid ~ .invalid-tooltip {
  display: block;
}

In 4.4.0 it changed to this (and remains the same in 4.5.0):

.was-validated #app:invalid ~ .invalid-feedback,
.was-validated #app:invalid ~ .invalid-tooltip, 
#app.is-invalid ~ .invalid-feedback,
#app.is-invalid ~ .invalid-tooltip {
    display: block; 
}

I don't think either of these is particularly correct in the .was-validated area but this bit #app.is-invalid ~ .invalid-feedback is tripping me up, missing a space between #app and .is-invalid.

I think the original fix that made nesting work was #17352, and then possibly what broke it again was #29264 or #28447.

Relevant build versions:
-webpack 4 with recommended scss rules
-node 14
-node-sass 4.14

@XhmikosR XhmikosR added the css label Jul 3, 2020
@mdo
Copy link
Member

mdo commented Jul 6, 2020

In general I despise the nested Sass rulesets in the validation mixin, but it was the easiest and sanest way forward at the time. I’m down to see it rewritten, though I don’t plan to focus on that myself anytime soon unfortunately.

Would be happy to review a PR!

@mdo
Copy link
Member

mdo commented Jan 13, 2021

Closing as stale—above comment still stands, though!

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

No branches or pull requests

3 participants