Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make save state icon accessible #8892

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Make save state icon accessible #8892

merged 1 commit into from
Aug 22, 2024

Conversation

robertknight
Copy link
Member

Extract the save status icons into a new component and make it accessible by:

  • Adding a role="status" container so that changes in labels are announced
  • Adding accessible labels to the saving / saved indicators

Testing:

  1. Apply the diff below
  2. Select a group in h and click the "Edit group" link
  3. Activate screen reader
  4. Click the "Save changes" button

You should hear "Saving changes..." being read out after clicking the button and then "Changes saved".

diff --git a/h/static/scripts/group-forms/utils/api.ts b/h/static/scripts/group-forms/utils/api.ts
index 273dc64ad..26ca218d5 100644
--- a/h/static/scripts/group-forms/utils/api.ts
+++ b/h/static/scripts/group-forms/utils/api.ts
@@ -109,5 +109,8 @@ export async function callAPI(
     });
   }
 
+  // TESTING
+  await new Promise(r => setTimeout(r, 2000));
+
   return responseJSON;
 }

Known issues:

I have noticed that when there is no save delay at all, Chrome does not always announce "Changes saved" if the form is edited again and re-saved after the first use of "Save changes". I'd like to investigate further, but I want to deploy this initial implementation first.

Extract the save status icons into a new component and make it
accessible by:

 - Adding a `role="status"` container so that changes in labels are
   announced
 - Adding accessible labels to the saving / saved indicators
@robertknight
Copy link
Member Author

Related to this, we don't currently have any mechanism preventing the user from accidentally closing the tab if they have unsaved changes. The LMS app has an implementation of this in the useWarnOnPageUnload hook.

@robertknight robertknight marked this pull request as ready for review August 22, 2024 11:55
Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robertknight robertknight merged commit 43f6268 into main Aug 22, 2024
9 checks passed
@robertknight robertknight deleted the save-state-icon branch August 22, 2024 12:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants