Skip to content

GlobalEventHandlersEventMap "command" mapped incorrectly #2554

Description

Command events fire a CommandEvent, however they are currently mapped to the basic Event interface.

Ref:
https://developer.mozilla.org/en-US/docs/Web/API/CommandEvent/command

At the moment, I need to assert or put a guard clause to get correct typing inside a command event handler. Please update the type mapping under GlobalEventHandlersEventMap.

Activity

  1. Bashamega commented on Sep 19, 2026

    @Bashamega
    Contributor

    Hello Jason P. Cochrane (@jpc-ae),

    I don't think this is an issue with the DOM lib generator itself. GlobalEventHandlersEventMap is generated from upstream WebRef data, and oncommand is defined as a generic EventHandler in the IDL.

    If the command event should be typed as CommandEvent, the upstream WebRef data/spec mapping would likely need to be fixed first.

    I'm not completely sure yet whether the upstream mapping is actually incorrect, though, so I think that should be verified before treating this as a generator issue.

  2. jpc-ae commented on Sep 19, 2026

    @jpc-ae
    Author

    At least according to the WHATWG spec (https://html.spec.whatwg.org/multipage/indices.html#events-2) oncommand (the command event) fires a CommandEvent. If it didn't, you wouldn't be able to access ev.command which is arguably one of the most important properties of the fired event.

    Would https://github.com/w3c/webref be the place to file an issue then? Or would it be even further upstream from there?

  3. Bashamega commented on Sep 19, 2026

    @Bashamega
    Contributor

    t least according to the WHATWG spec (html.spec.whatwg.org/multipage/indices.html#events-2) oncommand (the command event) fires a CommandEvent. If it didn't, you wouldn't be able to access ev.command which is arguably one of the most important properties of the fired event.

    Would w3c/webref be the place to file an issue then? Or would it be even further upstream from there?

    Not sure, but you can check there and make sure the isssue is from there

  4. jpc-ae commented on Sep 19, 2026

    @jpc-ae
    Author

    Hmm, as far as I can find, upstream is correct. Unless I'm looking in the wrong place? https://github.com/w3c/webref/blob/a0506ac035dfcb3c1e6c0be9127be0b28f15a534/ed/events/html.json#L638

  5. Bashamega commented on Sep 19, 2026

    @Bashamega
    Contributor

    You are looking at the right place i am not sure

  6. jpc-ae commented on Sep 19, 2026

    @jpc-ae
    Author

    Maybe the CommandEvent is not recognized by this generator and it falls back to Event? At the very least, it does seem like I've filed this in the right place.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions