Consider the following CSS rule:
input:focus,
div:focus-within {
box-shadow: none !important;
}
This rule overwrites Bootstrap's input box-shadow on focus and also a focus contained within a specific div. While the :focus-within
is a fairly new pseudo selector, it is assumed that IE and Edge won't understand the meaning of it.
Thus the expected outcome would be that IE and Edge would ignore the unrecognised selector and apply the CSS rule to the other matched selectors it does know.
However, this is not the case. They both ignore the whole rule, even though it understands the :focus
selector.
My question is:
Part 1: Why does it do this? Why not just ignore the single selector?
Part 2: Is there a hack to make them ignore the single selector, while still making it work on modern browsers?
Yes, I could make another css rule to only apply to IE and Edge, however that is just bloating the code and is somewhat unnecessary.