I have a user account page where I would like users to see a very basic form with the details of their account and, on page load, I would like this form to be in a read-only state. If users want to edit their account details, they can click on an edit button which will dynamically remove the readonly state of all of the input fields.
I have the following:
<button
type="button"
aria-pressed="false"
aria-controls="EditAccount"
>
Edit Account Details
</button>
<form id="EditAccount" class="profile-form">
<label for="first_name">First name</label>
<input type="text" name="first_name" id="first_name" value="Maria" readonly>
<label for="last_name">Last name</label>
<input type="text" name="last_name" id="last_name" value="Juana" readonly>
<button type="submit" hidden>Submit</button>
</form>
Would using the aria-controls
attribute on the button be enough to let users that use assistive technologies know that the button is toggling the readonly
state of the entire form?
I've found similar questions on Stack Overflow on how to toggle the readonly state of an entire form but none that address my accessibility concerns.
Would I need to use a different approach to make it clear to these users that the form is toggling between an editable and readonly state?