Rmwc: Clicking Tab submits form

Created on 3 Jun 2020  路  2Comments  路  Source: jamesmfriedman/rmwc

https://codesandbox.io/s/rmwc-typescript-sandbox-hxc2b?fontsize=14&hidenavigation=1&theme=dark

  • What RMWC Version are you using [major.minor.patch]: 6.0.14

  • Name your build system [Webpack, Rollup...]: Parcel

  • Describe the bug with as much detail as possible: Clicking a tab submits the form.

  • What happened, and what was supposed to happen: It should just change tabs, not submit the form.

bug

Most helpful comment

I just figured out the issue. HTML buttons are type=submit buttons by default. Tabs get rendered as <button> elements, but no type is set. Simply setting type=button on the <Tab> makes it work as expected. I strongly suggest either building this in to Tab, or putting it in the docs.

All 2 comments

I just figured out the issue. HTML buttons are type=submit buttons by default. Tabs get rendered as <button> elements, but no type is set. Simply setting type=button on the <Tab> makes it work as expected. I strongly suggest either building this in to Tab, or putting it in the docs.

That is very interesting and something we should likely report upstream as well. I'll take a look

Was this page helpful?
0 / 5 - 0 ratings