E-mail List Archives
Re: Forms that delete something
From: tim.harshbarger@deque.com
Date: Jan 9, 2024 7:24AM
- Next message: David Farough: "Re: Forms that delete something"
- Previous message: Jeremy Echols: "Re: Forms that delete something"
- Next message in Thread: David Farough: "Re: Forms that delete something"
- Previous message in Thread: Jeremy Echols: "Re: Forms that delete something"
- View all messages in this Thread
Realistically, whether or not the button is inside a form will be meaningful to someone using a screen reader. Unless you do something special, the person using a screen reader most likely will not be informed that the button is contained inside a form. However, what is important for people using screen readers is that the element conveys its role (that it is a button) and its name (that its label is delete).
There can be some keyboard advantages to using a form with a submit button. If a button is type="submit", it becomes the default action of the form which means that pressing enter on some other types of controls (like a text field) will activate that submit function without the person needing to tab to the submit button.
Regarding links vs. buttons, I expect those of us who are very focused on the design and development of user interfaces place way more emphasis on this than the people who use the user interfaces.
For example, you have a multi-page form with a next page and previous page function. Technically, if pressing next loads a whole new page it should be a link. If it is a Single Page App (SPA) which only updates some of the content on the page, it should be a button. For people who don't spend their days focused on this type of detail that is a meaningless difference.
It is most definitely advisable to try to use some kind of rule of thumb about links and buttons. It is probably more important that you are consistent within your interface than you try to apply the rule universally when it will have no meaning for non-technical users.
Hope this helps.
Thanks!
Tim
-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of Laurence Hughes
Sent: Monday, January 8, 2024 2:50 PM
To: <EMAIL REMOVED>
Subject: [WebAIM] Forms that delete something
Hi,
My companyâs web app is written in Ruby on Rails. As a developer, when you want to let the user delete something (from the database), a common approach is to use the Rails `button_toâ method. As a developer you pass into this method some text for a button and a URL for a server resource which will handle deleting the data. In terms of rendered HTML, the method generates a form set to use the POST method and to submit to the URL you provided. The form includes a button of type âsubmitâ and no other form elements except a hidden input which tells Rails to perform an HTTP DELETE rather than a POST.
As a sighted user, all I see is a button.
I see some benefits to this pattern. Developers have, for a long time, misused links (with the help of JavaScript) to enable deletion, and this isnât good. As we know, links are for a different purpose, and using a link for an unintended purpose breaks user expectations.
But while Iâm sure that a link is the wrong tool for the job of deleting something from a database, Iâm also not 100% sure whether a form, that only includes a single element (a button), is the right interface to present.
The user isnât really âinputtingâ anything, either to add, edit or search, so is a form OK here?
Would this feel weird to a screen reader user? A form with no other elements except a button that says âDelete xyzâ? Or am I being silly and this is perfectly normal, and is the expected/conventional way to provide a âDelete xyzâ interface accessibly?
Thanks in advance for any advice!
Laurence
- Next message: David Farough: "Re: Forms that delete something"
- Previous message: Jeremy Echols: "Re: Forms that delete something"
- Next message in Thread: David Farough: "Re: Forms that delete something"
- Previous message in Thread: Jeremy Echols: "Re: Forms that delete something"
- View all messages in this Thread