WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Forms that delete something

for

From: Dean.Vasile@outlook.com
Date: Jan 8, 2024 1:54PM


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