Hi all, thanks for the feedback.

@Stephen, thanks for the target milestone suggestion, I just changed it.

@Robert, I'll respond inline:

*"Ah, I put together a test page with some examples and I see that in fact 
we only return the highlights if they were not obscured. This wasn't clear 
to me from the spec, especially as the analogous API elementsFromPoint 
returns all elements, even those obscured.*

*It might make sense to have a unified API for hit test results that could 
return a combination of highlights and elements. E.g. if we had options for 
elementsFromPoint to also return highlights, to include elements with 
pointer-events: none, to stop at the first hit testing opaque element, 
etc."*

Custom highlights are supposed to be annotations on top of content, the use 
cases are about highlights that are visible, so the way I see it, it should 
return the ones that are not obscured. For example, for spellcheck 
annotations you wouldn't expect the highlights to react to you hovering 
over them if there's another element on top (like in your test page for 
instance). I'm filing an issue in CSSWG about this to define if it should 
include highlights that are obscured or not and will be updating the spec.

Regards this API also returning elements, I think it doesn't fit the use 
cases either, we could think about the same example I gave above.

*"Also, as was discussed in the linked issue, using event handlers would be 
the ideal way I think for developers to handle this."*

For this kind of solution there's been some discussion previously with the 
CSSWG as well and I wrote some explanation in the explainer for 
highlightsFromPoint 
<https://github.com/ffiori/MSEdgeExplainers/blob/master/highlight/HighlightsFromPointsExplainer.md#event-based-api>
.
Summarizing, all the event-based options analyzed carried significant 
complexity. This API was selected since it is much simpler to implement and 
still satisfies the use cases proposed adequately.
Setting an event listener on some user action to get them (as you did in 
your sample page) is a good way for developers to use it (see also the example 
in the spec 
<https://drafts.csswg.org/css-highlight-api-1/#highlights-from-point-ex>).

Please let me know if you've got any further questions or concerns.

Thanks,
Fernando


El miércoles, 19 de febrero de 2025 a la(s) 6:44:58 a.m. UTC-8, Robert 
Flack escribió:

Ah, I put together a test page <https://codepen.io/flackr/pen/MYWKQPv> with 
some examples and I see that in fact we only return the highlights if they 
were not obscured. This wasn't clear to me from the spec, especially as the 
analogous API elementsFromPoint returns all elements, even those obscured.

It might make sense to have a unified API for hit test results that could 
return a combination of highlights and elements. E.g. if we had options for 
elementsFromPoint to also return highlights, to include elements with 
pointer-events: none, to stop at the first hit testing opaque element, etc.

Also, as was discussed in the linked issue, using event handlers would be 
the ideal way I think for developers to handle this.

On Wed, Feb 19, 2025 at 8:56 AM Robert Flack <fla...@chromium.org> wrote:

When you add a click handler to get the highlights from a given point and 
interact with the highlight, how can you tell whether the returned 
highlight is topmost and should be handled? E.g. how can you tell that 
there's not a dialog element or some other absolute positioned element 
painted overtop of the highlight (and highlighted content)?

On Saturday, February 15, 2025 at 9:17:17 AM UTC-5 Stephen Chenney wrote:

I support this as a strongly desired feature for CSS Custom Highlights.

I believe the target milestone should be M-135 given M-134 is in Beta 
already for a week.

It's also worth pointing out that this method only returns 
custom highlights, not selection or spelling or any other highlight 
pseudos.  Furthermore, the highlights returned are all from 
the highlight registry specific to a given realm. Hence it does not expose 
any information not already known to the script (because script created the 
highlights in the first place).

Stephen.

On Fri, Feb 14, 2025 at 7:59 PM 'Fernando Fiori' via blink-dev <
blin...@chromium.org> wrote:

*Contact emails*

stephan...@microsoft.com, sa...@microsoft.com, ffi...@microsoft.com


*Explainer*

https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/highlight/HighlightsFromPointsExplainer.md


*Specification*

https://drafts.csswg.org/css-highlight-api-1/#interactions


*Summary*

The highlightsFromPoint API enables developers to interact with custom 
highlights by detecting which highlights exist at a specific point within a 
document. This interactivity is valuable for complex web features where 
multiple highlights may overlap or exist within shadow DOM. By providing 
precise point-based highlight detection, the API empowers developers to 
manage dynamic interactions with custom highlights more effectively, such 
as responding to user clicks or hover events on highlighted regions to 
trigger custom tooltips, context menus, or other interactive features. 




*Blink component*

Blink>CSS 
<https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3ECSS%22>


*TAG review*

https://github.com/w3ctag/design-reviews/issues/1043


*TAG review status*

Issues addressed


*Risks*




*Interoperability and Compatibility*

The 'highlightsFromPoint' API is a new feature so there isn’t a 
compatibility risk. The interoperability risk is limited to the usual risk 
of limited adoption and/or inconsistent browser support for a new feature.



*Gecko*: No signal (
https://github.com/mozilla/standards-positions/issues/1068)

*WebKit*: No signal (
https://github.com/WebKit/standards-positions/issues/394)

*Web developers*: Positive (
https://github.com/w3c/csswg-drafts/issues/7513#issuecomment-1211033472, 
https://github.com/w3c/csswg-drafts/issues/7447#issuecomment-2386160133, 
https://github.com/w3c/csswg-drafts/issues/7447#issuecomment-1183422904) 

*Other signals*:


*Ergonomics*

None




*Activation*

None




*Security*

None




*WebView application risks*

*Does this intent deprecate or change behavior of existing APIs, such that 
it has potentially high risk for Android WebView-based applications?*

None




*Debuggability*

None




*Will this feature be supported on all six Blink platforms (Windows, Mac, 
Linux, ChromeOS, Android, and Android WebView)?*

Yes


*Is this feature fully tested by web-platform-tests 
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>?*

Yes

https://wpt.fyi/results/css/css-highlight-api/HighlightRegistry-highlightsFromPoint.html?label=experimental&label=master&aligned

https://wpt.fyi/results/shadow-dom/HighlightRegistry-highlightsFromPoint.html?label=master&label=experimental&aligned

Note that these tests are currently failing in wpt.fyi because the feature 
still has the status test in code 
<https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5;l=2333?q=runtime_enabled_features.json&ss=chromium%2Fchromium%2Fsrc>,
 
so it’s not activated for these tests that run under experimental flag, but 
worth mentioning they’re passing in chromium CI. They’re expected to pass 
in wpt.fyi as well once the feature status is upgraded.



*Flag name on about://flags*

None


*Finch feature name*

HighlightsFromPoint


*Requires code in //chrome?*

False


*Tracking bug*

https://issues.chromium.org/issues/365046212


*Estimated milestones*

Shipping on desktop

134




*Anticipated spec changes*

*Open questions about a feature may be a source of future web compat or 
interop issues. Please list open issues (e.g. links to known github issues 
in the project for the feature specification) whose resolution may 
introduce web compat/interop risk (e.g., changing to naming or structure of 
the API in a non-backward-compatible way).*

None


*Link to entry on the Chrome Platform Status*

https://chromestatus.com/feature/4552801607483392?gate=4762112543686656


*Links to previous Intent discussions*

Intent to Prototype: 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/SJ0PR00MB130193097BB3B418C676D88CEC642%40SJ0PR00MB1301.namprd00.prod.outlook.com


This intent message was generated by Chrome Platform Status 
<https://chromestatus.com/>.

 

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.

To unsubscribe from this group and stop receiving emails from it, send an 
email to blink-dev+...@chromium.org.


To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/BL4PR00MB26636D7174ADA73FC348333DDCF92%40BL4PR00MB2663.namprd00.prod.outlook.com
 
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/BL4PR00MB26636D7174ADA73FC348333DDCF92%40BL4PR00MB2663.namprd00.prod.outlook.com?utm_medium=email&utm_source=footer>
.

-- 

You received this message because you are subscribed to the Google Groups 
"blink-dev" group.

To unsubscribe from this group and stop receiving emails from it, send an 
email to blink-dev+...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6ab7c016-61a9-4b09-add0-30d27a86785dn%40chromium.org
 
<https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6ab7c016-61a9-4b09-add0-30d27a86785dn%40chromium.org?utm_medium=email&utm_source=footer>
.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/23c57487-54df-47d2-8c4b-94be46b4df2cn%40chromium.org.

Reply via email to