Skip to content

Add type="button" to prevent form submit

Nathan Friend requested to merge nfriend-prevent-clear-button-form-submit into master

What does this MR do?

Adds type="button" to the GlClearIconButton component.

What problem does this solve?

When nested inside a <form>, this prevents the button from submitting the form when clicked. (When no type is specified, <button> elements inside a <form> act like a type="submit" button.)

This issue surfaced when !1550 (merged) was merged, because this change updated the GlClearIconButton to be hidden, instead of removed, from the DOM, allowing it to act as a submit button inside a <form>.

Dependencies

gitlab!36652 (merged) must first be merged, because adding type="button" makes a few RSpec selectors ambiguous.

Edited by Nathan Friend

Merge request reports

Loading