fix: soften 'never' in pointer-events:none description (fixes #44565)#44566
Open
nihalakp wants to merge 1 commit into
Open
fix: soften 'never' in pointer-events:none description (fixes #44565)#44566nihalakp wants to merge 1 commit into
nihalakp wants to merge 1 commit into
Conversation
| - : The element behaves as it would if the `pointer-events` property were not specified. In SVG content, this value and the value `visiblePainted` have the same effect. | ||
| - `none` | ||
| - : The element on its own is never the [target](/en-US/docs/Web/API/Event/target) of pointer events. However its subtree could be kept targetable by setting `pointer-events` to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to or from the descendant during the event capture and [bubble](/en-US/docs/Web/API/Event/bubbles) phases. | ||
| - : The element on its own is generally not the [target](/en-US/docs/Web/API/Event/target) of pointer events. However its subtree could be kept targetable by setting `pointer-events` to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to or from the descendant during the event capture and [bubble](/en-US/docs/Web/API/Event/bubbles) phases. Note that `pointerenter` and `pointerleave` events are exceptions — they will still fire on a parent with `pointer-events: none` when the pointer moves into or out of a descendant that is hit-testable. |
Collaborator
There was a problem hiding this comment.
@nihalakp Thanks for this.
- If you plan on fixing your own issue you don't need to create an issue - just a PR. However if you do create an issue then you should usually wait for triage.
- I think you're correct - "never" is wrong. I suspect "on its own" was supposed to capture that an element with no descendents would not be a target, but it misses that there are genuine exceptions in
pointerenterandpointerleave. - My problem with this is that there is way too much duplication in having your sentence "Note that
pointerenter... immediately followed by the note, which covers much the same ground.
A possible fix is to mention the exception up front and then rely on the note - see below.
Suggested change
| - : The element on its own is generally not the [target](/en-US/docs/Web/API/Event/target) of pointer events. However its subtree could be kept targetable by setting `pointer-events` to some other value. In these circumstances, pointer events will trigger event listeners on this parent element as appropriate on their way to or from the descendant during the event capture and [bubble](/en-US/docs/Web/API/Event/bubbles) phases. Note that `pointerenter` and `pointerleave` events are exceptions — they will still fire on a parent with `pointer-events: none` when the pointer moves into or out of a descendant that is hit-testable. | |
| - : The element is generally not the [target](/en-US/docs/Web/API/Event/target) of pointer events, with the exception of `pointerenter` and `pointerleave` events fired at the element or its descendents. | |
| Note that pointer events targeted at descendents (that don't set `pointer-events` to `none`) will still trigger event listeners on this parent element during the event capture and [bubble](/en-US/docs/Web/API/Event/bubbles) phases. |
Happy for you to propose an alternative that removes the duplication if this isn't quite correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updated the
pointer-events: nonedescription to replace "never" with "generally not" and added a clarifying sentence about thepointerenter/pointerleaveexception.Motivation
The word "never" in the opening sentence is technically inaccurate —
pointerenterandpointerleaveevents can still fire on a parent withpointer-events: nonewhen the pointer moves into or out of a hit-testable descendant. A Note block on the page already acknowledges this, but the main description contradicts it. This change makes the two consistent and more accurate for readers.Additional details
Relates to the original issue #33633, which was closed after a Note block was added but the main description was not updated.
Related issues and pull requests
Fixes #44565
Relates to #33633