creativecommons / search

Creative Commons Search Portal
https://search.creativecommons.org/
MIT License
19 stars 114 forks source link

[Bug] Change Search Button Type to submit for Clarity #292

Open Silvia-Wachira opened 1 month ago

Silvia-Wachira commented 1 month ago

Description

The current implementation of the search feature uses a button element that does not specify a type. This can lead to inconsistent behavior across different browsers and may prevent the form from submitting correctly.

Expectation

The button should be of type submit to indicate its purpose clearly. While the form submits as expected, It is better to change the type to submit so as to improve code clarity and maintainability across various browsers.

Environment

Resolution

possumbilities commented 1 month ago

Hi @Silvia-Wachira , thanks for noting this.

The form isn't actually submitted, but actually captured via JS, and then opens a page from the values. I'm unsure if setting the type here as any meaningful use, but I'm not opposed to it.

Does anyone else know of a reason why leaving or adding it might be worth doing, given that the form doesn't submit in a formal sense?

Silvia-Wachira commented 1 month ago

I appreciate the clarification that the form submission is handled via JavaScript and doesn’t submit in the traditional sense so in this case it might not have a significant impact on functionality but it could still be beneficial to future contributors or developers maintaining the project who might expect a form button to be of type submit, especially in form-based interactions. Adding the type makes the intention clearer, even if JavaScript handles the actual submission. @possumbilities