Skip to content

Conversation

@jakearchibald
Copy link
Collaborator

@jakearchibald jakearchibald commented Dec 16, 2025

The previous spec seemed to allow all commands through if the element was a popover, whereas it was only intended to allow popover commands through.

Firefox and Safari follow the intent of the spec. Chrome kinda gets it wrong but wasn't following the previous wording of the spec either. I'll file a bug with them.

  • At least two implementers are interested (and none opposed):
    • Firefox
  • 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.)


/form-elements.html ( diff )

Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

Nice. LGTM.

@lukewarlow
Copy link
Member

Good catch!

@mfreed7
Copy link
Collaborator

mfreed7 commented Dec 16, 2025

Thanks! LGTM.

source Outdated
<div algorithm>
<p>To <dfn data-x="determine-if-command-is-valid">determine if a command is valid for a
target</dfn> given a <code data-x="attr-button-command">command</code> attribute
<var>command</var> and an <code>HTMLElement</code> <var>target</var>:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<var>command</var> and an <code>HTMLElement</code> <var>target</var>:</p>
<var>command</var> and an element <var>target</var>:</p>

As far as I can tell it's not restricted to an HTML element.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was an assert in the other algorithm. But maybe that was an error?

Copy link
Member

Choose a reason for hiding this comment

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

I think so. [CEReactions, Reflect] attribute Element? commandForElement; suggests to me anyway that any kind of element can be assigned here.

Perhaps this is lacking test coverage @keithamus?

Copy link
Member

Choose a reason for hiding this comment

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

Custom commands work for non-HTML elements, previously there was an assert but importantly it was in a conditional.

If isPopover is false and command is not in the Custom state:

  1. Assert: target's namespace is the HTML namespace.

Custom commands never went down the branch of checking for valid commands, so it was fine.

Copy link
Member

Choose a reason for hiding this comment

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

So this suggested change + my extra step below should fix this.

source Outdated
<li><p><span data-x="attr-button-command-hide-popover-state">Hide Popover</span></p></li>
</ul>

<p>Then return true.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p>Then return true.</p>
<p>then return true.</p>

Comment on lines 55653 to 55655
<li><p>If this standard does not define <span>is valid command steps</span> for
<var>target</var>'s <span data-x="concept-element-local-name">local name</span>, then return
false.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

It seems there's a problem as these steps are restricted to HTML elements.

Also, it would have been better if we always defined these steps. They just return false unless overridden.


<li><p>If <var>command</var> is in the <span
data-x="attr-button-command-custom-state">Custom</span> state, then return true.</p></li>

Copy link
Member

@lukewarlow lukewarlow Dec 17, 2025

Choose a reason for hiding this comment

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

We need to add an extra step here (so it would become step 3) that says if target's namespace is not the HTML namespace then return false.

@jakearchibald
Copy link
Collaborator Author

jakearchibald commented Dec 18, 2025

I think I've addressed the feedback. I've also made my Mozilla membership public, which should sort out the participation thing.

The build failure seems unrelated.

@jakearchibald
Copy link
Collaborator Author

@annevk finally got the participation stuff sorted

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.

6 participants