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

Bob/5817 return focus on archive close #5931

Merged
merged 14 commits into from
Jun 6, 2023

Conversation

fzhao99
Copy link
Contributor

@fzhao99 fzhao99 commented Jun 5, 2023

FRONTEND PULL REQUEST

Related Issue

Fixes #5817

Changes Proposed

  • Returns focus to the action menu of the relevant user when the archive modal is closed
  • Adds a corresponding test
  • Retain the default focus to the patient search bar
  • Decided to refocus on the action menu for the user row in question rather than the explicit archive button, since
    • I'm guessing that when users go back from the archive menu, moving back to the action menu would allow them to redirect themselves as needed (ie tab to the next user row, move to the "Start test" option instead) better than the actual archive button in the expanded list.
    • The secondary action dropdown isn't expanded on modal exit and it didn't seem worth it to expand it programmatically in this case

Testing

  • deployed on dev 2
  • To replicate
    • Navigate to the manage patients menu
    • Select archive a patient
    • Exit out of the modal and notice focus returns to the action button

Screenshots / Demos

Screen.Recording.2023-06-05.at.1.03.17.PM.mov

Checklist for Author and Reviewer

Accessibility

  • Any large changes have been run through Deque manual testing
  • All changes have run through the Deque automated testing

@fzhao99 fzhao99 temporarily deployed to Dev2 June 5, 2023 18:29 — with GitHub Actions Inactive
BobanL
BobanL previously approved these changes Jun 5, 2023
Copy link
Contributor

@BobanL BobanL left a comment

Choose a reason for hiding this comment

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

Changes look good and passes accessibility!

@fzhao99 fzhao99 marked this pull request as ready for review June 5, 2023 18:43
render(<TestContainer />);
expect(await screen.findByText(patients[0].lastName, { exact: false }));

const menu = (await screen.findAllByText("More actions"))[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you wrap these actions in the act method or switch them to fireEvent.click? It is to not get the act warnings . You can add an .only to the it method to only run the new added coverage it.only( so you can test it isolated!

Copy link
Contributor Author

@fzhao99 fzhao99 Jun 6, 2023

Choose a reason for hiding this comment

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

So I did a little bit of digging around this because it was annoying me and I think I found that the root cause is a package versioning mismatch. Expo here.

TL;DR is that our versions of @testing-library/dom need to match throughout the tree in order to not generate unnecessary act warnings. Right now, running the yarn list on @testing-library/dom gives us the following:

├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
│  └─ @testing-library/[email protected]
└─ [email protected]
   └─ @testing-library/[email protected]

Once I updated the root installation of @testing-library/dom to 9.3.0 locally, the errors went away, even when using the userEvent action. For now, I just went ahead and replaced the one troublesome assertion with fireEvent so as to not add new errors, but hopefully the other errors will go away once we upgrade.

Copy link
Contributor

Choose a reason for hiding this comment

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

ooo this is cool so if we upgrade @testing-library/dom to 9.3.0 the errors will get fixed in the other files as well?. I wonder why we haven't receive this upgrade from dependabot 🤔

Copy link
Contributor Author

@fzhao99 fzhao99 Jun 6, 2023

Choose a reason for hiding this comment

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

Yeah, when I updated locally the other related errors in the file also went away. I didn't run it on the whole test suite though, so unsure if it'll fix everything. I'm guessing that it's in the queue per my question here.

actually more digging reveals that this package is on a indirect dependency that we don't actually install, which is probably why there aren't any pull requests being made for it despite appearing in the scans. Upgrading the package manually unfortunately breaks some of the other unit tests. We also have some other dependencies that use this package as a subdependency that haven't upgraded yet, so we're somewhat constrained by those packages until then.

Upshot is that if we want to get rid of the warnings, we'll need to either manually install / keep in sync the subdependency or wait until the relevant packages upgrade. If we don't want to do that, we can either live with the warnings or write new tests using fireEvent where appropriate. Makes sense to me to do the later and just punt until the other packages get around to upgrading.

zdeveloper and others added 5 commits June 6, 2023 10:05
* only send common device values in fhir bundle

* correct the service request to use test order loinc and completed status in bulk uploader fhir
* make uac all required

* replace userEvent with fireEvent
* Migrated form to react-hook-forms

* Updated unit test

* fixed code smell

* Fixed mocked answers for experian demo endpoint
@fzhao99 fzhao99 requested review from BobanL and johanna-skylight and removed request for mehansen, BobanL, emyl3 and johanna-skylight June 6, 2023 15:06
@fzhao99 fzhao99 requested review from mehansen and emyl3 June 6, 2023 15:08
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@johanna-skylight johanna-skylight left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@BobanL BobanL left a comment

Choose a reason for hiding this comment

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

👍

@fzhao99 fzhao99 merged commit 4daf437 into main Jun 6, 2023
@fzhao99 fzhao99 deleted the bob/5817-return-focus-on-archive-close branch June 6, 2023 17:59
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.

Archive patient modal does not return focus to when exiting modal
4 participants