v149 · Web Components · Forms

Keyboard Activation

A native <button type="submit"> submits its form when focused and the user presses Enter or Space. Without HTMLSubmitButtonBehavior, a custom element must wire this up manually. With the behavior, the platform handles it — tab to the button, press Enter, and the form submits identically to the native case.

Tab into each form, type a name, then use Tab to reach the submit button and press Enter or Space.

Native <button type="submit">
Tab to button → Enter or Space submits
Waiting for submit…
Custom element + HTMLSubmitButtonBehavior
Tab to button → Enter or Space submits
Waiting for submit…
0native submits
0behavior submits
0Enter key events
0Space key events
Interaction log
// Tab to a button and press Enter or Space…

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗