Re: Submitting a form. BUTTON or INPUT

Thanks Patrick.

I GUEss it's personal preference..? I'll explain (apologies for this being a sort of internal monologue).

BUTTON says to me, press or don't press.

INPUT says, put stuff in (in my head it says that). It does not really say press (while a 'press' is arguably something being put in to a page, that's feels weak).

So to me, if the raison d'être of a BUTTON is to be pressed/clicked, and an INPUT is ​*really​* a place to put stuff in, not a place to take presses, and BUTTON was introduced to finally give us a native way to most appropriately receive presses/clicks, then it seems sad (sad for the BUTTON element) to not use it, when that's all it's there for.

Sorry that explanation was not likely what you were looking for when you asked (and for anthropomorphizing the BUTTON element(!)).

Regards,

Alan

. . . . -   . . - - -
Alan Bristow ( he / him / il )
Web Developer / Développeur Web
Elections Canada / Élections Canada
alan.bristow@elections.ca<mailto:alan.bristow@elections.ca>

________________________________
From: Patrick H. Lauke <redux@splintered.co.uk>
Sent: 01 February 2024 15:06
To: w3c-wai-ig@w3.org <w3c-wai-ig@w3.org>
Subject: Re: Submitting a form. BUTTON or INPUT

Ce message a été envoyé par un expéditeur externe. Veuillez faire preuve de prudence et ne pas cliquer sur les liens ou ouvrir les pièces jointes à moins de reconnaître l'expéditeur et de savoir que le contenu est sûr.

This message was sent from an external sender. Please exercise caution and do not click links or open attachments unless you recognize the sender and know the content is safe.



On 01/02/2024 19:19, Bristow, Alan wrote:
[...]
> I would love to strongly advocate for BUTTON,

Any particular actual reason why? Other than personal preference?

Both <input type="submit"> and <button type="submit"> work exactly the
same, are both exposed as buttons in the accessibility API, announced as
buttons by screen readers. The only difference is that <button> allows
for more flexibility in terms of content (as you can have other elements
inside it, compared to just having the value="..." attribute on the
input). But for simple submit buttons that just have a text label, there
is no strong reason...

P
--
Patrick H. Lauke

* https://www.splintered.co.uk/

* https://github.com/patrickhlauke

* https://flickr.com/photos/redux/

* https://mastodon.social/@patrick_h_lauke

Received on Thursday, 1 February 2024 20:21:01 UTC