Skip to content

Commit

Permalink
Fix focus order after form submission (#407)
Browse files Browse the repository at this point in the history
* added function to change focus after form submit

* updated CHANGELOG
  • Loading branch information
krischarbonneau authored Oct 26, 2021
1 parent b43cb21 commit 8b97315
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- The two `<p>` tags above the feedback form textarea are now announced to screen reader users by use of `aria-describedby`
- The feedback form close button is now before the `<h2>` in page order
- Typo in the redirect path for the thank you page when switching back to EN
- Focus is properly set to before elements in status message after submitting feedback form

## [v1.1.2] - 2021-09-27

Expand Down
5 changes: 5 additions & 0 deletions components/organisms/PhaseBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const PhaseBanner = ({ phase, children, feedbackActive }) => {
}

setSubmitted(true);
setFocusAfterSubmit();
} else {
setFeedbackError(error.message);
srSpeak(error.message);
Expand Down Expand Up @@ -110,6 +111,10 @@ export const PhaseBanner = ({ phase, children, feedbackActive }) => {
}, 1000);
}

function setFocusAfterSubmit() {
document.getElementById("feedbackButton").focus();
}

return (
<>
<div className="bg-circle-color">
Expand Down

0 comments on commit 8b97315

Please sign in to comment.