Current behavior
Matches an element that has user focus or contains an element that has user focus
Expected behavior
Matches an element that contains an element that has user focus
Reasons
-
The current behavior overlaps with that of :focus (non-orthogonal)
-
Consider this nested UI scenario: list view items containing nested buttons. The list view items and the nested buttons are clickable.

- When user presses a list view item, the
:active state should be applied to it
- When user presses a nested button, the button should be styled as
:active, but the list view item should not be. With the current behavior of :focus-within, this is impossible to achieve. However, if the behavior of :focus-within is changed to the expected behavior above, this can be achieved as follows
/* User presses the list view item, not the buttons */
list-view-item:active:not(:focus-within) {
background-color: #0006;
}
/* User presses a nested button */
button:active {
background-color: #0006;
}
-
The current behavior can be achieved by combining :focus and :focus-within
Refercences
https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo
https://stackoverflow.com/questions/33114318/css-prevent-parent-element-getting-active-pseudoclass-when-child-element-is-cl
Current behavior
Matches an element that has user focus or contains an element that has user focus
Expected behavior
Matches an element that contains an element that has user focus
Reasons
The current behavior overlaps with that of
:focus(non-orthogonal)Consider this nested UI scenario: list view items containing nested buttons. The list view items and the nested buttons are clickable.

:activestate should be applied to it:active, but the list view item should not be. With the current behavior of:focus-within, this is impossible to achieve. However, if the behavior of:focus-withinis changed to the expected behavior above, this can be achieved as followsThe current behavior can be achieved by combining
:focusand:focus-withinRefercences
https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo
https://stackoverflow.com/questions/33114318/css-prevent-parent-element-getting-active-pseudoclass-when-child-element-is-cl