Skip to content

Conversation

keithamus
Copy link
Member

@keithamus keithamus commented Oct 8, 2023

This adds the commandfor & command attributes and a "command" event using the CommandEvent interface.

Button activation checks if the button has a "commandfor" target and if so performs invoker command behaviour depending on command and the target element.

Some related (eventual) follow up issues around this feature:

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


/dom.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/interaction.html ( diff )
/interactive-elements.html ( diff )
/webappapis.html ( diff )

@keithamus keithamus changed the title Add invoke Add InvokeElement & InvokeEvent IDLs for Invoke proposal Oct 9, 2023
@keithamus keithamus changed the title Add InvokeElement & InvokeEvent IDLs for Invoke proposal Add InvokeElement & InvokeEvent IDLs & invocation steps for Invoke proposal Oct 9, 2023
@keithamus keithamus marked this pull request as ready for review October 10, 2023 22:28
@keithamus keithamus force-pushed the add-invoke branch 3 times, most recently from 45e4032 to 9579336 Compare October 17, 2023 20:32
@scottaohara
Copy link
Collaborator

scottaohara commented Oct 18, 2023

I realize this is also in the steps for getting the popover target element, but in both cases I'm wondering why its specified to return null if the node is in the disable state?

Doing so, at least with <button popovertarget=foo disabled> testing in chrome, results in that element not exposing whether the popover is in the expanded or collapsed state - as I'm assuming due to

"If node is disabled, then return null."

that state gets removed. That's unexpected, to have that state removed based on whether the button is disabled or not. And for invokertarget - if it is really is going to do more than just show/hide content - there are a lot of other states that should still be exposed, regarless of if the element is in the disabled state or not.

edit: I can file a bug for disabled / popovertarget if necessary - i just wanted to get insight on this first, before I went and made that issue. cc @mfreed7

@keithamus

This comment was marked as outdated.

@keithamus keithamus force-pushed the add-invoke branch 2 times, most recently from 7f0f9ea to 834a8b1 Compare October 18, 2023 21:36
keithamus added a commit to keithamus/wpt that referenced this pull request Oct 20, 2023
@lukewarlow
Copy link
Member

Fwiw HTML requires a positive standards position or for chrome LGTMs on an intent to ship to be considered supportive.

Saying that Mozilla have marked their position as positive so that's 1 implementor interested.

I do wonder how this requirement works for a feature such as this which will require multiple PRs to add to the spec?

@domenic
Copy link
Member

domenic commented Nov 5, 2023

a feature such as this which will require multiple PRs to add to the spec?

I'm confused why this feature is being done as multiple PRs; it makes review a good deal harder.

@keithamus
Copy link
Member Author

If it makes it easier to review I’m happy to put more into one PR. I figured it would be worthwhile splitting it into the core vs each elements behaviour as I imagine there will be more to discuss with each elements behaviour.

@domenic
Copy link
Member

domenic commented Nov 5, 2023

Well, it'd make it easier for me, but I haven't signed up to review yet, so no need to make any changes until we get some more opinions :)

Edited to add: the reason it makes it more difficult is that I don't think we want to accept the feature piecemeal.

@lukewarlow
Copy link
Member

As per openui/open-ui#900 (comment) this'll need updating to only fire the event when the action is custom (has a hypen) or is recognised and valid (correct action name on correct element).

TLDR is that this will allow us to add default actions in future without conflicting with user land code.

@lukewarlow
Copy link
Member

In openui/open-ui#952 (comment) we resolved that "Invokers v1 will be popover and dialog invoking."

This should help keep this initial PR as small as possible while also avoid the issue of reviewing stuff piecemeal.

So #9875 can be merged into this along with dialog related changes.

@mfreed7
Copy link
Collaborator

mfreed7 commented Jan 17, 2024

Fwiw HTML requires a positive standards position or for chrome LGTMs on an intent to ship to be considered supportive.

Saying that Mozilla have marked their position as positive so that's 1 implementor interested.

Chromium is explicitly supportive of this proposal, so I believe it has two implementer support (including Mozilla).

Is this PR in a state that it can get a review? I'm happy to do so, if it'd help.

@keithamus
Copy link
Member Author

I'd be happy to get reviews, I think this is in a good position for that.

@mfreed7
Copy link
Collaborator

mfreed7 commented Jan 17, 2024

I'd be happy to get reviews, I think this is in a good position for that.

Done - I added a first set of comments.

@keithamus
Copy link
Member Author

@foolip thanks for the new review! All comments addressed.

Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

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

Thanks @keithamus, I think we're good to go here. I left two final (really!) suggestions that I hope can be applied without any knock-on effects.

@keithamus
Copy link
Member Author

@foolip thanks! Addressed both of those comments.

@foolip
Copy link
Member

foolip commented Feb 19, 2025

Checklist up top looks good, merging this and web-platform-tests/wpt#42664 😄

@foolip foolip merged commit 81fa58f into whatwg:main Feb 19, 2025
2 checks passed
foolip pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 19, 2025
AtkinsSJ added a commit to AtkinsSJ/ladybird that referenced this pull request Feb 20, 2025
Corresponds to part of whatwg/html#9841 and then
whatwg/html#11047

Adding `Auto` as a type state feels a little odd, as it's not an actual
type allowed in HTML. However, it's the default state when the value is
missing or invalid, which works out the same, as long as we never
serialize "auto", which we don't.
AtkinsSJ added a commit to AtkinsSJ/ladybird that referenced this pull request Feb 21, 2025
Corresponds to part of whatwg/html#9841 and then
whatwg/html#11047

Adding `Auto` as a type state feels a little odd, as it's not an actual
type allowed in HTML. However, it's the default state when the value is
missing or invalid, which works out the same, as long as we never
serialize "auto", which we don't.
tcl3 pushed a commit to LadybirdBrowser/ladybird that referenced this pull request Feb 22, 2025
Corresponds to part of whatwg/html#9841 and then
whatwg/html#11047

Adding `Auto` as a type state feels a little odd, as it's not an actual
type allowed in HTML. However, it's the default state when the value is
missing or invalid, which works out the same, as long as we never
serialize "auto", which we don't.
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Feb 26, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 27, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664
aarongable pushed a commit to chromium/chromium that referenced this pull request Feb 27, 2025
Intent to ship:
https://groups.google.com/a/chromium.org/g/blink-dev/c/ctNbl4gWLuk/m/NXmcIDLlAQAJ.

Merged spec PR: whatwg/html#9841.

Bug: 40284894
Change-Id: I2c37dd8eb968948de420d673c0a21bcddf2bf75b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6281568
Reviewed-by: Luke <[email protected]>
Reviewed-by: Chris Harrelson <[email protected]>
Commit-Queue: Chris Harrelson <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Reviewed-by: Vladimir Levin <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1425940}
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 1, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664

UltraBlame original commit: b45ce137f4196f86aede8cf995cc794cc5d5cb56
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 1, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664

UltraBlame original commit: b45ce137f4196f86aede8cf995cc794cc5d5cb56
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 1, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664

UltraBlame original commit: b45ce137f4196f86aede8cf995cc794cc5d5cb56
F3n67u pushed a commit to F3n67u/ladybird that referenced this pull request Mar 5, 2025
Corresponds to part of whatwg/html#9841 and then
whatwg/html#11047

Adding `Auto` as a type state feels a little odd, as it's not an actual
type allowed in HTML. However, it's the default state when the value is
missing or invalid, which works out the same, as long as we never
serialize "auto", which we don't.
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 5, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664
lozy219 pushed a commit to lozy219/html that referenced this pull request Mar 10, 2025
glandium pushed a commit to mozilla-firefox/firefox that referenced this pull request Apr 1, 2025
…testonly

Automatic update from web-platform-tests
Mark invokers tests as non-tentative (#42664)

See related spec PR whatwg/html#9841
--

wpt-commits: e014b2613b2873099d628953eb5ca74ace1bdcf2
wpt-pr: 42664
annevk pushed a commit that referenced this pull request May 12, 2025
#9841 did not do this correctly, likely do it being developed over a long period of time in which this algorithm changed shape.
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…tribute, a=testonly

Automatic update from web-platform-tests
Drop 'auto' keyword from invokeaction attribute

The spec proposal has been updated to use missing default of an
'auto' state, with no associated keyword.

This patch aligns Chromium and the WPT tests with that change.

Proposal PR: whatwg/html#9841
Proposal explainer: https://open-ui.org/components/invokers.explainer/

Bug: 40286318
Change-Id: Ib62d749d8428490630aa9181bc055bc6f102b420
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5347628
Commit-Queue: Luke <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1269645}

--

wpt-commits: d4298204f72a23fa916db2d2479bda9771147c17
wpt-pr: 44959
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…flect new spec decisions., a=testonly

Automatic update from web-platform-tests
Rename & refactor invoker commands to reflect new spec decisions.

Invoker commands now live solely on HTMLButtonElement, and have been
dropped from HTMLInputElement. This was discussed and resolved + minuted
in Jul 18 WHATNOT meeting:
whatwg/html#10471 (comment))

Words must be separated with dashes. This was discussed and resolved +
minuted in Jul 18 WHATNOT meeting:
whatwg/html#10471 (comment))

"Custom" commands now require a double dash (`--`) prefix. This was
discussed & resolved + minuted in the Jul 25 OpenUI meeting:
openui/open-ui#969 (comment)

In addition, CommandEvent#invoker is now renamed to CommandEvent#source
as discussed and resolved + minuted in Jul 18 WHATNOT meeting:
whatwg/html#10471 (comment))

This CL updates the tests & implementation to follow these changes. The
changes can also be found in the spec PR which reflects this updated
status:

whatwg/html#9841

Bug: 40284894
Change-Id: Iefa91a1736867239a21f8717aee1fcaaa54fdfd0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5839601
Reviewed-by: Mason Freed <[email protected]>
Reviewed-by: Luke <[email protected]>
Commit-Queue: Keith Cirkel <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1367705}

--

wpt-commits: 5df7a2c02bb50efa0368910fd49242c08def7a5d
wpt-pr: 48581
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
… values, a=testonly

Automatic update from web-platform-tests
Reflect command attribute to known-valid values

This changes the reflection rules of the command attribute to match the
spec - whatwg/html#9841. The command attribute
should only reflect known values (or custom ones) and for invalid values
it should return the empty string.

Bug: 394874179
Change-Id: I76d2139762137027961e385250e0976d9395d778
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6240672
Reviewed-by: Mason Freed <[email protected]>
Reviewed-by: Luke <[email protected]>
Commit-Queue: Keith Cirkel <[email protected]>
Auto-Submit: Keith Cirkel <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1418568}

--

wpt-commits: 3117023f41189ce423c0a7aa96f58d9baea3abab
wpt-pr: 50628
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition/proposal New features or enhancements

Development

Successfully merging this pull request may close these issues.