Skip to content

Commit

Permalink
Update Button params.type to match the documentation
Browse files Browse the repository at this point in the history
Our documentation says Button components as `<button>` should always default `params.type` to `submit`:

> Type of `input` or `button` – `button`, `submit` or `reset`. Defaults to `submit`. This has no effect on `a` elements.

Rather than rely on `<button>` to implicitly default to `type="submit"` we should set it in the HTML
  • Loading branch information
colinrotherham committed Aug 31, 2023
1 parent fa83143 commit 95366f7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ treat it as an interactive element - without this it will be
</a>

{%- elseif element == 'button' %}
<button {%- if params.value %} value="{{ params.value }}"{% endif %}{%- if params.type %} type="{{ params.type }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
<button {%- if params.value %} value="{{ params.value }}"{% endif %} type="{{ params.type if params.type else 'submit' }}" {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
{{ params.html | safe if params.html else params.text }}
{# Indentation is intentional to output HTML nicely #}
{{- iconHtml | safe | trim | indent(2, true) if iconHtml -}}
Expand Down

0 comments on commit 95366f7

Please sign in to comment.