Skip to content

Commit 5b448ca

Browse files
committed
Remove interestaction from interest invokers
1 parent f609b55 commit 5b448ca

File tree

1 file changed

+7
-28
lines changed

1 file changed

+7
-28
lines changed

site/src/pages/components/interest-invokers.explainer.mdx

+7-28
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ layout: ../../layouts/ComponentLayout.astro
2121

2222
## Introduction
2323

24-
Following [invokers](../invokers.explainer), adding an `interesttarget` and `interestaction`
24+
Following [invokers](../invokers.explainer), adding an `interesttarget`
2525
attributes to interactive elements: starting with `<button>`, `<input
2626
type="button">`/`<input type="reset">`/`<input type="submit">`, `<a>`, and `<area>` (perhaps
2727
expanding to `<input>`, `<textarea>`, `<select>`, `<summary>` or maybe more, see
@@ -68,13 +68,12 @@ interest.
6868

6969
## Proposed Plan
7070

71-
In the style of `invoketarget`, this document proposes we add `interesttarget` and `interestaction`
71+
In the style of `invoketarget`, this document proposes we add `interesttarget`
7272
as available attributes to `<button>`, `<a>`, `<area>` and `<input>` elements.
7373

7474
```webidl
7575
interface mixin InterestInvokerElement {
7676
[CEReactions] attribute Element? interestTargetElement;
77-
[CEReactions] attribute DOMString interestAction;
7877
};
7978
HTMLButtonElement includes InterestInvokerElement
8079
HTMLInputElement includes InterestInvokerElement
@@ -90,20 +89,6 @@ some cases, see [attr-asociated element
9089
steps](https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#attr-associated-element)
9190
for more).
9291

93-
The `interestaction` (and the `interestAction` reflected property) is a freeform hint
94-
to the interestee. InterestAction can be a "built-in" action or a "custom" action.
95-
If `interestaction` is a false value (`''``, `null`, etc), then it will default to
96-
an `auto` state.
97-
98-
Built-in interactive elements have built-in behaviours (detailed below) which
99-
are determined by the `interestaction`. The built-in names _must not_ contain a
100-
`-`. An `interestaction` without a dash that is not a built-in is considered
101-
invalid, and will not dispatch an InterestEvent.
102-
103-
Valid interestactions (that is: custom interestaction or a valid built-in) will
104-
dispatch InterestEvent, allowing custom code to take control of interest invocations (for
105-
example calling `.preventDefault()` or executing custom side-effects).
106-
10792
Elements with `interesttarget` set will dispatch an `InterestEvent` on the
10893
_Interestee_ (the element referenced by `interesttarget`) when the element
10994
_Shows Interest_ or _Loses Interest_. When the element _Shows Interest_ the
@@ -157,7 +142,7 @@ allowing for custom JavaScript to be triggered without having to wire up manual
157142
event handlers to the Interest elements.
158143

159144
```html
160-
<button interesttarget="my-custom" interestaction="custom-action">
145+
<button interesttarget="my-custom">
161146
When this button shows interest, the below div will display.
162147
</button>
163148

@@ -166,11 +151,9 @@ event handlers to the Interest elements.
166151
<script>
167152
const custom = document.getElementById("my-custom");
168153
custom.addEventListener("interest", (e) => {
169-
if (e.action !== "custom-action") return;
170154
custom.classList.add('active')
171155
});
172156
custom.addEventListener("loseinterest", (e) => {
173-
if (e.action !== "custom-action") return;
174157
custom.classList.remove('active')
175158
});
176159
</script>
@@ -202,14 +185,10 @@ Showing/losing interest on an interesttarget will _always_ dispatch a trusted
202185
specific element types are handled. Note that this list is ordered and higher
203186
rules take precedence:
204187

205-
When the `interestaction` attribute is missing it will default to an auto state.
206-
207-
| Interestee Element | `action` hint | Event Type | Behaviour |
208-
| :----------------- | :--------------- | :--------------- | :--------------------------------------|
209-
| `<* popover=*>` | (auto) | `'interest'` | Call `.togglePopover()` on the invokee |
210-
| `<* popover=*>` | `togglePopover` | `'interest'` | Call `.togglePopover()` on the invokee |
211-
| `<* popover=*>` | (auto) | `'loseinterest'` | Call `.togglePopover()` on the invokee |
212-
| `<* popover=*>` | `togglePopover` | `'loseinterest'` | Call `.togglePopover()` on the invokee |
188+
| Interestee Element | Event Type | Behaviour |
189+
| :----------------- | :--------------- | :--------------------------------------|
190+
| `<* popover=*>` | `'interest'` | Call `.showPopover()` on the invokee |
191+
| `<* popover=*>` | `'loseinterest'` | Call `.hidePopover()` on the invokee |
213192

214193
> Note: The above table is an attempt at wide coverage, but ideas are welcome. Please submit a PR if you have one!
215194

0 commit comments

Comments
 (0)