W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [css-pseudo] Please change the behavior of :focus-within (#5654)

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Fri, 23 Oct 2020 17:22:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-715472010-1603473771-sysbot+gh@w3.org>
The overlapping nature of the pseudos is intentional - in many cases you *do* want to apply your focus styles whether the element itself or a descendant is what has focus, so the eye is drawn to the element in either case.

Cases like yours were considered relatively rarer, and they're still solveable with the current design:

  <tr><td>Select parent when...<th>Parent has focus<th>Parent doesn't have focus
 <tr><th>Child has focus<td><code>:focus-within</code><td><code>:focus-within:not(:focus)</code>
 <tr><th>Child doesn't have focus<td><code>:focus</code><td><code>:not(:focus-within)</code>

GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5654#issuecomment-715472010 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 23 October 2020 17:22:53 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:21 UTC