Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

@W-14338017@ Fix: accessibility focus for my account pages and promo code #1625

Merged
merged 18 commits into from
Dec 21, 2023

Conversation

joeluong-sfcc
Copy link
Collaborator

@joeluong-sfcc joeluong-sfcc commented Dec 20, 2023

Description

This PR fixes several focus accessibility issues:

  • When entering invalid promo code, error message is now read when focusing on the input field
    • This works on v2 but not on v3 due to a documented regression where there is no feedback provided when entering an invalid promo code
  • Navigating through the my account pages (account details, wishlist, order history, addresses) sets the focus onto the corresponding page heading instead of staying on the navigation link
  • after removing a product from wishlist, focus is set to Wishlist heading instead of onto the body
  • Opening up an address form causes focus to shift to the address form
  • Closing out of address form by saving or cancelling changes focus to the edit button that opened the address form
  • removing an address changes focus to the Addresses heading on the Addresses page
  • Canceling out of address form or removing address in checkout page changes focus to the Shipping Addresses heading

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)
  1. git checkout ju/fix-focus.W-14338017
  2. npm ci
  3. cd packages/template-retail-react-app
  4. npm run start
  5. navigate to my account pages, specifically addresses
  6. observe that focus shifts automatically to the heading of the corresponding page
  7. observe that hitting the adding/editting address buttons sets focus to address form
  8. observe that canceling or saving address form sets focus to address heading
Screenshot 2023-12-20 at 10 48 03 AM

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@joeluong-sfcc joeluong-sfcc marked this pull request as ready for review December 20, 2023 16:48
@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner December 20, 2023 16:48
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similarly, we are missing handling the focus when users click the Cancel or Save buttons on the form opened by clicking the 'Edit' button in the Account Details page.

<FormActionButtons onCancel={() => setIsEditing(false)} />

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There wasn't a straightforward way to maintain a reference to the edit buttons since the edit buttons disappear from the DOM when in edit mode and get re-rendered after the form is closed, so for now I set the focus to the Profile/Password heading when you click the Cancel/Save buttons in edit mode

@joeluong-sfcc joeluong-sfcc merged commit 9ea7159 into develop Dec 21, 2023
28 checks passed
@joeluong-sfcc joeluong-sfcc deleted the ju/fix-focus.W-14338017 branch December 21, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants