Skip to content

[selectors-4] confilct between HTML :focus and CSS :focus #789

Description

@frivoal

https://drafts.csswg.org/selectors-4/#the-focus-pseudo

On Aug 20, 2015, at 13:50, @fantasai said in a mail

Heya Florian,
I was just reviewing
https://hg.csswg.org/drafts/rev/2539f118cb22

Hello, this is zombie email waking up from the dead.

I'm not sure if the conformance clause is on the host language spec
or directly on UAs. This needs to be clearer. If it's on the host
language, then it should probably be a should and not a must. And
if it's directly on UAs, then we've probably got a clash with HTML.
In which case we should be clearer about the fact that our spec is
asking to override the HTML spec.

It is meant to be a requirement on the UA.

The Resolution for doing that is here https://lists.w3.org/Archives/Public/www-style/2014Nov/0553.html

The main intent was to have propagation from/to the label just like :active does, it was felt more elegant to do it by saying that :focus propagates the same as :active (except to parents), and that :focus-within would be the same as :focus, plus parents.

However, this assumes there's not compat issue in propagating :focus the same way :active propagates, but there seems to be some:

https://lists.w3.org/Archives/Public/www-style/2014Nov/0292.html

Somehow that mail predates the resolution, and yet we didn't take it into account. Oops.

So, what do we do?

  1. Try to amend HTML on the hope that the compat problems are small enough.
    I doubt this will be successful, based on @zcorpan’s investigation quoted above.
    Even if we do, we probably need to find some other hook than “the same as :active except parents”, as the HTML spec text for that doesn't seem to me to generalize well to things other than :active https://html.spec.whatwg.org/multipage/scripting.html#selector-active

  2. remove propagation of :focus and keep :focus-within = :focus + parents
    This would preserve the main motivation for :focus-within (matching ancestors), but as we'd loose propagation to/from labels, which was judged desirable as well, and does not have a compat problem.

  3. Remove propagation of :focus and redefine propagation of :focus-within to/from labels some other way
    That seems the best to me, but any idea how to phrase that? As I said above, the phrasing for :active in the HTML spec doesn't generalize well.


Mentioning the people who were involved in the original discussion:
@tabatkins @tantek @zcorpan @fantasai

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions