Skip to content

Add the interesttarget attribute #11006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Add the interesttarget attribute #11006

wants to merge 8 commits into from

Conversation

foolip
Copy link
Member

@foolip foolip commented Feb 6, 2025

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno (only for timers, structured clone, base64 utils, channel messaging, module resolution, web workers, and web storage): …
    • Node.js (only for timers, structured clone, base64 utils, channel messaging, and module resolution): …
  • Corresponding HTML AAM & ARIA in HTML issues & PRs:
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/browsers.html ( diff )
/form-elements.html ( diff )
/image-maps.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/popover.html ( diff )
/semantics-other.html ( diff )
/text-level-semantics.html ( diff )
/interesttarget.html ( diff )

@foolip
Copy link
Member Author

foolip commented Feb 6, 2025

This is an initial translation of https://open-ui.org/components/interest-invokers.explainer/ to spec language, with a lot of things incomplete.

@mfreed7 I think the two biggest points of uncertainty I have now are the integration with mouse/keyboard/touch input on the one end, and with CSS on the other.

For showing interest, the timing of these algorithms relative to "mouseover" and other events needs to be defined.

For CSS, the fact that there are CSS properties controlling the timing means we need to think about:

  • When do we look at the computed style to extract those times?
  • Is there a state machine with timers, and is anything observable between the initial sign of interest and when we run "capture interest"?

There are many more minor TODOs, but I'd like to get the high-level flow settled first.

@foolip foolip changed the title Add the interesttarget attribute Add the interesttarget attribute Feb 6, 2025
source Outdated
@@ -74941,6 +74947,13 @@ contradict people?
data-x="concept-selector-active">being activated</i>.)</p>
</dd>

<dt><dfn selector noexport><code data-x="selector-has-interest">:has-interest</code></dfn></dt>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this belong here in HTML? Or better only in CSS?

Copy link
Member Author

Choose a reason for hiding this comment

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

The typical setup is that https://drafts.csswg.org/selectors/ defines that the selectors exist, and then HTML defines when it matches for HTML. The idea is that HTML is a "host language" and there can be others, like SVG.

source Outdated
&lt;/div></code></pre>
</div>

<p>Every <span data-x="HTML elements">HTML element</span> has a <dfn>has interest</dfn>, which is a
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is the HTML spec, but the plan at least was to minimally support <svg> <a> elements. So perhaps this should be just Element?

Copy link
Member Author

Choose a reason for hiding this comment

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

Popovers were only made to work for HTML elements, if I'm reading the spec correctly. Would just interesttarget without fully working popovers be useful, or would it seem broken? (We can fix both, if it would be useful.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I know. But popovers (the popovertarget attribute) should likely have supported SVG <a> also. But let's not fight that battle now - it's ok by me to keep this as-is, using HTML element. Side note: even if we support interesttarget on non-HTML elements, it's still ok that the target element as a popover is only supported on HTML elements.

source Outdated

<ul>
<li><p>Actually invoke the capture/lose algorithms.</p></li>
<li><p>Which algorithm reads the computed style for interest-target-delay?</p></li>
Copy link
Contributor

Choose a reason for hiding this comment

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

There need to be algorithms equivalent to these from Chromium code:

I think those three should hit most of the things in this list. Hopefully.

@foolip foolip force-pushed the foolip/interesttarget branch from 0aac997 to 9e40cb6 Compare May 14, 2025 14:52
<ul>
<li><p><dfn export for="interest state" data-x="interest-state-none">none</dfn></p></li>

<li><p><dfn export for="interest state" data-x="interest-state-partial">partial</dfn></p></li>
Copy link
Member Author

Choose a reason for hiding this comment

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

@mfreed7 Chromium additionally has a "potential partial interest" state used for popovers:

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/element.cc;l=11060-11067;drc=743a82d08e59d803c94ee1b8564b8b11dd7b462f

Do we have to do the same in the spec? Or can we check if the target element is a popover when the scheduled task runs? The popover attribute could be removed before the task runs, so checking it ahead of time seems like it adds the need to double-check it later.

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

Successfully merging this pull request may close these issues.

2 participants