Skip to content

Commit 51f2b36

Browse files
committed
[selectors-4] Fix :interest-source to only match the active source, not a potential source. Also rewrite to provide some dfn hooks for HTML to refer to.
1 parent f3d0da1 commit 51f2b36

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

selectors-4/Overview.bs

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,26 +2516,48 @@ The Focus Container Pseudo-class: '':focus-within''</h3>
25162516
<h3 id="interest-pseudos">
25172517
The Interest Pseudo-classes: '':interest-source'' and '':interest-target''</h3>
25182518

2519-
[=Host languages=] can define that certain elements
2520-
are capable of "showing interest" in another element
2521-
(typically, an informative popup),
2522-
so that when a user interacts with the first element,
2523-
the second element can be shown or otherwise rendered differently.
2524-
2525-
Issue: TODO Add reference to the HTML feature when it's fully landed.
2519+
A common UI feature is the ability for the user to "show interest" in certain elements
2520+
(an <dfn export>interest source</dfn>),
2521+
and the UI to respond to that interest
2522+
by showing additional information in another element
2523+
(the <dfn export>interest target</dfn>),
2524+
typically a popup.
2525+
For example, hovering a username on a page
2526+
might bring up an information card for that user;
2527+
or long-pressing a link
2528+
might bring up a preview of the link's destination.
2529+
Whenever this happens, the first element
2530+
2531+
Note: Exactly what elements are capable of being [=interest sources=],
2532+
how they're linked to [=interest targets=],
2533+
and how "interest" is shown
2534+
are all [=host language=]-defined.
2535+
In HTML, for example,
2536+
this is done with the <{html-global/interestfor}> attribute
2537+
to indicate an element capable of "showing interest"
2538+
(being an [=interest source=],
2539+
and that attribute points to another element
2540+
intended to show the additional information
2541+
(the associated [=interest target=])
2542+
(usually a <{html-global/popover}> element).
25262543

25272544
The <dfn>:interest-source</dfn> pseudo-class
2528-
applies to any element (or pseudo-element)
2529-
that is capable of "showing interest" in another element,
2530-
as defined by the [=host language=].
2531-
(It applies regardless of whether the element
2532-
is <em>currently</em> showing interest or not.)
2533-
2534-
The <dfn>:interest-target</dfn> pseudo-class
2535-
applies to the "other element"
2536-
that an '':interest-source'' element is currently showing interest in.
2537-
(It only applies to an element
2538-
that is <em>currently</em> having interest shown in it.)
2545+
applies to an [=interest source=] element that the user is currently "showing interest" in,
2546+
and the <dfn>:interest-target</dfn> pseudo-class
2547+
applies to the associated [=interest target=]
2548+
of an element matching '':interest-source''.
2549+
2550+
Note: '':interest-source'' only matches an [=interest source=]
2551+
the user is <em>currently</em> interested in,
2552+
not any element that can <em>potentially</em> have interest shown in it.
2553+
In HTML, for example,
2554+
just having the <{html-global/interestfor}> attribute
2555+
does not make an element match this pseudo-class;
2556+
the user has to actually indicate interest in it too.
2557+
Similarly, '':interest-target'' only matches an [=interest target=]
2558+
that is linked to an element the user is <em>currently</em> interested in,
2559+
not any element pointed to by an <{html-global/interestefor}> attribute.
2560+
25392561

25402562
<h2 id="time-pseudos">
25412563
Time-dimensional Pseudo-classes</h2>

0 commit comments

Comments
 (0)