material-web: Pressing enter in a text field does not submit form

Hi! I’ve built a small form example:

<form method="GET">
  <md-outlined-text-field
    type="text"
    name="name"
  ></md-outlined-text-field>
  <md-filled-button label="Submit" type="submit"></md-filled-button>
</form>

But it does not submit in any of the following cases:

  • Click the Submit button
  • Press Enter key when the text field is focused
  • Press Enter key when the button is focused

I understand it’s an issue related to shadow dom, but, is there a way to make this work as expected?

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 8
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Have the bug fixed? It still cannot work on the latest Chrome.

Not yet, the issue is still open

Updated the title. Text fields do add their data to submitting forms, but pressing the enter key in a text field will not automatically submit its form right now. You’ll need to add keydown listeners and handle that manually.