WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Forms that delete something

for

From: Peter Weil
Date: Jan 10, 2024 7:33AM


Thanks for clarifying this, Tim.

I don’t think there’s any question that using a button, using the technique described below, is the way to go for making a one-off change to a database. Using a form for this seems perfectly fine, but perhaps not always necessary. If you have a page with multiple delete (and perhaps other) buttons on a page, embedding each button within a form could get a little onerous, especially if there is little or no clear advantage to doing so.

Inertia.js, for example, provides a REST API that enables you to make make DELETE, PATCH, etc. requests without using a form. This can be very useful and convenient, as long as you make the buttons accessible.

Peter

> On Jan 10, 2024, at 7:25 AM, <EMAIL REMOVED> wrote:
>
> Yes, that is correct. That is what I meant to write.
>
> A screen reader will not tell a user if a form control is nested inside a form element.
>
> If someone does think it is important the screen reader user know that form controls are part of a form, then there are techniques that can be used to do that. However, just nesting controls inside a form element will not do that.
>
> The crucial aspects of the technique that was originally mentioned are:
>
> * It is possible to tab to the button and activate it with a keyboard.
> * The button conveys its role.
> * The button conveys an accessible name.
>
> It sounds like the technique did all of that. One additional consideration might be if there are multiple delete buttons on the same page. In that case, you might want to include additional information so it is more obvious to a screen reader user what the delete button will delete.
>
> If there is some kind of confirmation message for the delete action, you will also want to ensure there is some way screen reader users are informed of that status.
>
> Again, there are other reasons why someone would use a form element to contain all the controls for a form, but none of those reasons involve it somehow automatically informing screen reader users of that information.
>
> I apologize for the lack of clarity on the last response. I hope this helps.
>
> Thanks!
> Tim
> -----Original Message-----
> From: Peter Weil < <EMAIL REMOVED> >
> Sent: Tuesday, January 9, 2024 5:25 PM
> To: WebAIM Discussion List < <EMAIL REMOVED> >
> Cc: Tim Harshbarger < <EMAIL REMOVED> >
> Subject: Re: [WebAIM] Forms that delete something
>
> Tim,
>
> Did you mean to say that "whether or not the button is inside a form will **not** be meaningful to someone using a screen reader”?
>
> Otherwise, I find these two sentences confusing:
>
>> 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.
>
> I’m still not entirely persuaded (yet) that it is necessarily better or more helpful to place the button inside a form. And is this just for deletions? What about patches that, say, remove or change a relationship in the database?
>
> Thanks,
>
> Peter
>
> --
> Peter Weil
> Web Developer
> University Marketing Web Services
> Office of Strategic Communications
> University of Wisconsin–Madison
> 608-220-3089
>
>
>