thomas-lowry / figma-plugin-ds

A small lightweight design system for use in Figma Plugins
MIT License
693 stars 71 forks source link

Use regular button for select options #58

Open nlopin opened 1 year ago

nlopin commented 1 year ago

Issue

If select element is wrapped in form:

  <form>
      <select class="select-menu">
             <option value="1">Option 1</option>
             <option value="2">Option 2</option>
      </select>
  </form>

The form will be submitted every time when user selects a new value. This is undesired behaviour because only explicit submit button must send the form

Reason

<button> html tag has the type property set to submit by default

Solution

Set type to button.

button: The button has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur.

MDN