Repository: wagtail/wagtail
Pull request: Adds type attributes for some buttons.
Fixes #8213 adding `type=button` to buttons that were previously missing it. I didn't see a reason for `submit` on any of them. 

Problem statement:
Missing type attribute for <button> elements
### Issue Summary

This is a report from experimental automated tests which I have only partly confirmed.

There are a number of `<button>` elements in our templates which are missing a `type` attribute to indicate the button’s type – either `button` or `submit`. This attribute is optional, but defaults to `submit`, which can be a source of bugs. As such, we always prefer to systematically add an explicit `type` attribute.

### Steps to Reproduce

Here are the flagged templates:

```
wagtail/admin/templates/wagtailadmin/account/settings_panels/avatar.html
wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html
wagtail/contrib/forms/templates/wagtailforms/index_submissions.html
```

Hints from issue discussion:
@0saurabh0 sorry, this is already being worked on by @jessemenn 😕.

Commit message: Adds type attributes for some buttons.

Patch to review:
diff --git a/wagtail/admin/templates/wagtailadmin/account/settings_panels/avatar.html b/wagtail/admin/templates/wagtailadmin/account/settings_panels/avatar.html
index 15f4a85c5f78..30fb5367a64e 100644
--- a/wagtail/admin/templates/wagtailadmin/account/settings_panels/avatar.html
+++ b/wagtail/admin/templates/wagtailadmin/account/settings_panels/avatar.html
@@ -12,7 +12,7 @@
             <input type="hidden" name="avatar-avatar-clear" id="avatar-avatar-clear_id">
 
             {% if form.avatar.value %}
-                <button class="avatar-panel__revert-to-gravatar button button-secondary" data-gravatar-url="{% avatar_url request.user 100 gravatar_only=True %}">{% trans "Reset to default" %}</button>
+                <button type="button" class="avatar-panel__revert-to-gravatar button button-secondary" data-gravatar-url="{% avatar_url request.user 100 gravatar_only=True %}">{% trans "Reset to default" %}</button>
             {% endif %}
         </div>
     </div>
diff --git a/wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html b/wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html
index ec512dda2800..a25a962d0197 100644
--- a/wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html
+++ b/wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html
@@ -6,7 +6,7 @@ <h2 id="bulk-actions-heading" class="visuallyhidden">{% trans "Bulk actions" %}<
         <ul class="bulk-actions-buttons">{% bulk_action_choices app_label model_name %}</ul>
         <span data-bulk-action-num-objects class="num-objects"></span>
         {% if objects.has_other_pages %}
-            <button data-bulk-action-num-objects-in-listing class="num-objects-in-listing u-hidden">{{ select_all_obj_text }}</button>
+            <button type="button" data-bulk-action-num-objects-in-listing class="num-objects-in-listing u-hidden">{{ select_all_obj_text }}</button>
         {% endif %}
     </div>
 </section>
diff --git a/wagtail/contrib/forms/templates/wagtailforms/index_submissions.html b/wagtail/contrib/forms/templates/wagtailforms/index_submissions.html
index 205cb57dc069..41b06eed4659 100644
--- a/wagtail/contrib/forms/templates/wagtailforms/index_submissions.html
+++ b/wagtail/contrib/forms/templates/wagtailforms/index_submissions.html
@@ -97,7 +97,7 @@ <h1>
                                 {% include "wagtailadmin/shared/field_as_li.html" with field=field field_classes="field-small" li_classes="col4" %}
                             {% endfor %}
                             <li class="submit col2">
-                                <button name="action" value="filter" class="button button-filter">{% trans 'Filter' %}</button>
+                                <button type="button" name="action" value="filter" class="button button-filter">{% trans 'Filter' %}</button>
                             </li>
                         </ul>
                     </div>


Code review comments:
diff_hunk: @@ -97,7 +97,7 @@ <h1>
                                 {% include "wagtailadmin/shared/field_as_li.html" with field=field field_classes="field-small" li_classes="col4" %}
                             {% endfor %}
                             <li class="submit col2">
-                                <button name="action" value="filter" class="button button-filter">{% trans 'Filter' %}</button>
+                                <button type="button" name="action" value="filter" class="button button-filter">{% trans 'Filter' %}</button>
path: wagtail/contrib/forms/templates/wagtailforms/index_submissions.html
text: @user1:
I think this one does need to be `type="submit"`, since it's only on form submission / page reload that the filter will be applied to the listing.