Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

JackRyan1989
Copy link
Contributor

@JackRyan1989 JackRyan1989 commented Mar 30, 2023

🎫 Ticket

πŸ›  Summary of changes

  • Add role=link to BackButton components on Prepare Step page. Since the element is already a button, it has the keyboard functionality of a button, but now it is recognized by screen readers as anchor link.
  • Removed href prop for SpinnerButton and Button components rendering both as buttons, the location update occurs in the onclick callback functions.

πŸ“œ Testing Plan

  • Confirm all JS tests pass
  • Run the app locally, confirm that the Back buttons navigate to the previous page in the IPP flow
  • Locally, confirm that the "Try Again in Person" button on the location page, and the "Continue" button on the prepare page both navigate you to the next page

πŸ‘€ Screenshots

There should be no visible changes to the UI.

@JackRyan1989 JackRyan1989 requested review from a team and allthesignals March 30, 2023 19:16
@JackRyan1989 JackRyan1989 self-assigned this Mar 30, 2023
/>
)}
<BackButton includeBorder onClick={toPreviousStep} />
<BackButton role="link" includeBorder onClick={toPreviousStep} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we planning to prevent the spacebar from activating these fake links, since a link wouldn't be expected to be activated when pressing Space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally no, and I don't think this alters the functionality of the HTML element, rather just how it is presented to AT. And I could've sworn spacebar still triggered the back button, but maybe I need to test again and in another browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so I've tested the functionality of the back buttons in both Safari and Firefox and they respond to both Space and Enter/mouse click events.

Copy link
Contributor

Choose a reason for hiding this comment

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

My expectation is that it wouldn't be activated when hitting Spacebar. It's a small detail, and maybe it ends up being helpful to have both options to activate, but if the idea with this is to make a link behave strictly as a link ought to behave, then I'd expect part of that to restrict interaction to the supported keypresses.

In general, I'm become a bit wary of this proposed behavior, but I see the upstream uswds/uswds#4385 has recently been approved, so that train may have already left the station.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, your point is taken. What I'm doing here isn't really material honesty either, it's a button that is masquerading as a link, but still works like a button. At least now a screen reader will match what a sighted user might assume from the element's styling.

className="margin-top-3 margin-bottom-1"
onClick={() =>
onClick={() => {
setStepName('location');
Copy link
Contributor

Choose a reason for hiding this comment

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

i feel like this change also makes the code easier to read

removeUnloadProtection();
await trackEvent('IdV: prepare submitted');
window.location.href = (event.target as HTMLAnchorElement).href;
window.location.href = inPersonURL!;
Copy link
Contributor

Choose a reason for hiding this comment

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

i like that this is more explicit/easier to read

Copy link
Contributor

@svalexander svalexander left a comment

Choose a reason for hiding this comment

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

lgtm!

@JackRyan1989 JackRyan1989 merged commit e77eae2 into main Apr 5, 2023
@JackRyan1989 JackRyan1989 deleted the jryan/lg-9345-maintain-material-consistency-in-ipp branch April 5, 2023 18:14
jc-gsa pushed a commit that referenced this pull request Apr 19, 2023
* Change a few links that look like buttons into buttons add link role to a button that is effectively a link

* changelog: User-Facing Improvements, In-person proofing, Make IPP buttons and links into what they look like

* Remove left over comment

* Fix JS errors, replace click_link with click_button
mww59 pushed a commit that referenced this pull request May 4, 2023
* Change a few links that look like buttons into buttons add link role to a button that is effectively a link

* changelog: User-Facing Improvements, In-person proofing, Make IPP buttons and links into what they look like

* Remove left over comment

* Fix JS errors, replace click_link with click_button
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.

4 participants