WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Forms that delete something

for

From: Chase, DJ
Date: Jan 9, 2024 8:19AM


Habitually using forms for this also allows you to be consistent if you occasionally want to ask for conformation --- all you need to do is just include a required checkbox in the form to confirm.

Cheers,
--
DJ Chase
Digital Accessibility Specialist, NECC
They, Them, Theirs
+1 978 556 3794

From: WebAIM-Forum < <EMAIL REMOVED> > on behalf of Jeremy Echols < <EMAIL REMOVED> >
Sent: Monday, January 8, 2024 17:47
To: WebAIM Discussion List
Subject: Re: [WebAIM] Forms that delete something

[You don't often get email from <EMAIL REMOVED> . Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

ATTENTION: This email is from an external source. Do Not click on any links or open any attachments unless you recognize the sender and know the content is safe. To report a suspicious email, please use the new phishing alert button in outlook

Agreed - the HTML "form" may feel like it's incorrect because the name "form" sort of suggests to our collective conscious something with lots of blank spaces that needs information. But it is indeed the right element to use for deletion.

Think of it as a pre-filled paper form where all you have to do is submit it to the right person / organization in order to, say, start a free trial of Sirius XM or something. All the necessary data was pre-printed onto that form because they want it to be easy, so all you have to do is submit it. Same concept with the button-only form: it's been "pre-filled" with the hidden values (such as the request to delete a record). And the action itself, which holds the destination URL, is also just pre-filled data telling the form what it's for and likely the database ID of the record to delete.

-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of <EMAIL REMOVED>
Sent: Monday, January 8, 2024 12:54
To: WebAIM Discussion List < <EMAIL REMOVED> >
Subject: Re: [WebAIM] Forms that delete something

Using a form with just a button for deletion is a common and accessible approach. Screen reader users are accustomed to interacting with forms for various actions, including deletion. It helps maintain consistency and aligns with web accessibility standards.
Dean Vasile


617-799-1162

> On Jan 8, 2024, at 3:49 PM, Laurence Hughes < <EMAIL REMOVED> > wrote:
>
> 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