Skip to content

fix: prefer first non-zero rect for interactability checks#1965

Open
juliandescottes wants to merge 1 commit into
w3c:masterfrom
juliandescottes:issue1961
Open

fix: prefer first non-zero rect for interactability checks#1965
juliandescottes wants to merge 1 commit into
w3c:masterfrom
juliandescottes:issue1961

Conversation

@juliandescottes

@juliandescottes juliandescottes commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #1961

This matches the implementation as updated in Firefox. WPT tests already cover potential edge cases related to this (web-platform-tests/wpt#60371)


This change is Reviewable


Preview | Diff

@juliandescottes

juliandescottes commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

I don't understand the build failure here, it seems to complain about node but this is unrelated to my change?

Edit: No idea why this only started failing now, but let's see: #1966

@whimboo

whimboo commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@juliandescottes can you please rebase? CI actions should no longer show this error.

@juliandescottes

Copy link
Copy Markdown
Contributor Author

@juliandescottes can you please rebase? CI actions should no longer show this error.

Sure,done!

@whimboo whimboo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two wording comments from my side.

Comment thread index.html
Comment on lines 4590 to 4595
<p>An <a>element</a>&apos;s <dfn data-lt="center point">in-view center point</dfn>
is the origin position of the rectangle
that is the intersection between
the element&apos;s first {{DOMRect}} of {{Element/getClientRects()}}
with non-zero width and height (or the first {{DOMRect}} if none have non-zero dimensions)
and the <a>initial viewport</a>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and the <a>initial viewport</a>.
<p>An <a>element</a>&apos;s <dfn data-lt="center point">in-view center point</dfn>
is the origin position of the rectangle
that is the intersection between
the element&apos;s {{DOMRect}} and the <a>initial viewport</a>.
The {{DOMRect}} is the first result of {{Element/getClientRects()}}
with non-zero width and height, or the first result if none qualify.

Comment thread index.html
Comment on lines 4599 to 4604
<li><p>Let <var>rectangle</var> be
the first object of the {{DOMRect}} collection
returned by calling {{Element/getClientRects()}} on <a><var>element</var></a>.
the first object in the {{DOMRect}} collection
returned by calling {{Element/getClientRects()}} on <a><var>element</var></a>
that has non-zero width and height,
or the first object in the collection if no such object is found.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another suggestion so that it reads better IMHO. Sadly I cannot get GitHub to let me create a suggestion. :(

Let rectangle be the first object in the DOMRect collection returned by calling getClientRects() on element whose width and height are both non-zero. If no such object exists, let rectangle be the first object in the collection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"in-view center point" is broken when an inline element contains block-level elements

2 participants