w3c / w3c/csswg-drafts

[css-ui] State that `pointer-events: none` on frame prevents hit-testing its contents

Open
#7,069 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

css-ui-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

https://drafts.csswg.org/css-ui-4/#valdef-pointer-events-none defines pointer-events: none as

Hit-testing acts as if the boxes generated by the element (see [CSS-DISPLAY-3]) were not there, effectively causing the element behind the pointer-events: none element to become the target of hit-testing based events instead.

This should make it explicit that if you have something like

<button>You can click me</button><br>
<iframe style="pointer-events: none" srcdoc="<button>You can't click me</button>"></iframe>

Then hit-testing will skip the button inside the iframe, even if it has pointer-events: auto (CSS properties don't inherit into iframes).

We already have interoperability among Blink, WebKit and Gecko. They behave as desired.

And this is important for inert: if the iframe becomes inert, it gets pointer-events: none per https://github.com/w3c/csswg-drafts/issues/6685#issuecomment-930305697, and this should prevent interaction with its contents, even if they aren't marked as inert.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSS UI 4 definition of pointer-events: none and its hit-testing text linked in the issue, then review the related inert discussion in issue #6685. Update the specification to state that hit-testing skips an iframe's contents when the iframe has pointer-events: none, and verify that the wording reflects the interoperable Blink, WebKit, and Gecko behavior described here.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.