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

Fix/992 notify data file search selection changes #2209

Merged

Conversation

jtimpe
Copy link

@jtimpe jtimpe commented Oct 25, 2022

Summary of Changes

Pull request closes #992

  1. Notify the user when they are about to change their search params without having submitted their attached file.
  2. Change the fiscal year header on the reporting page to update without the search button being clicked (related finding mentioned in ticket details)

How to Test

cd tdrs-frontend && npm run start
cd tdrs-backend && docker-compose up

1. Notify the user when they are about to change their search params without having submitted their attached file.

  1. Open http://localhost:3000/ and sign in.
  2. Approve your user and assign a role. In the frontend, navigate to the "Data Files" tab. Apply some search filters and click "search".
  3. Attach a data file, but do not submit it.
  4. Change the search filters, click "Search". A modal should display notifying the user that their attached file will be cleared if they continue with the search. they have two options:
    • a. Cancel - this resets the search filters to their previous values (before the user clicked "Search") and maintains the attached file
    • b. Search - this clears the attached file and proceeds with the search, fetching files for the newly selected parameters

2. Change the fiscal year header on the reporting page to update without the search button being clicked.

  1. Open http://localhost:3000/ and sign in.
  2. Approve your user and assign a role. In the frontend, navigate to the "Data Files" tab. Apply some search filters and click "search".
  3. Change the search filter values. The report header in the middle of the page should "live update" without the need for clicking the search button.

This functionality was removed in favor of a more accessibility-friendly page flow. The user is now required to actually submit the search input form in order to both refresh the search screen and set the global state values for data file submission.

Deliverables

More details on how deliverables herein are assessed included here.

Deliverable 1: Accepted Features

Checklist of ACs:

  • Frontend raises an error/warning notification if user changes selections after upload but prior to submit
  • Frontend matches mock ups
  • lfrohlich and/or adpennington confirmed that ACs are met.

Deliverable 2: Tested Code

  • Are all areas of code introduced in this PR meaningfully tested?
    • If this PR introduces backend code changes, are they meaningfully tested?
    • If this PR introduces frontend code changes, are they meaningfully tested?
  • Are code coverage minimums met?
    • Frontend coverage: [insert coverage %] (see CodeCov Report comment in PR)
    • Backend coverage: [insert coverage %] (see CodeCov Report comment in PR)

Deliverable 3: Properly Styled Code

  • Are backend code style checks passing on CircleCI?
  • Are frontend code style checks passing on CircleCI?
  • Are code maintainability principles being followed?

Deliverable 4: Accessible

  • Does this PR complete the epic?
  • Are links included to any other gov-approved PRs associated with epic?
  • Does PR include documentation for Raft's a11y review?
  • Did automated and manual testing with iamjolly and ttran-hub using Accessibility Insights reveal any errors introduced in this PR?

Deliverable 5: Deployed

  • Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

Deliverable 6: Documented

  • Does this PR provide background for why coding decisions were made?
  • If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces dependencies, are their licenses documented?
  • Can reviewer explain and take ownership of these elements presented in this code review?

Deliverable 7: Secure

  • Does the OWASP Scan pass on CircleCI?
  • Do manual code review and manual testing detect any new security issues?
  • If new issues detected, is investigation and/or remediation plan documented?

Deliverable 8: User Research

Research product(s) clearly articulate(s):

  • the purpose of the research
  • methods used to conduct the research
  • who participated in the research
  • what was tested and how
  • impact of research on TDP
  • (if applicable) final design mockups produced for TDP development

@jtimpe jtimpe added the WIP label Oct 25, 2022
@jtimpe jtimpe marked this pull request as draft October 25, 2022 22:31
@jtimpe jtimpe added raft review This issue is ready for raft review and removed WIP labels Oct 27, 2022
@jtimpe jtimpe marked this pull request as ready for review October 27, 2022 14:11
@codecov
Copy link

codecov bot commented Oct 27, 2022

Codecov Report

Merging #2209 (e091cb3) into develop (5e0284b) will decrease coverage by 0.06%.
The diff coverage is 80.64%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2209      +/-   ##
===========================================
- Coverage    93.87%   93.80%   -0.07%     
===========================================
  Files           53       91      +38     
  Lines         1713     2485     +772     
  Branches       218      337     +119     
===========================================
+ Hits          1608     2331     +723     
- Misses          85      110      +25     
- Partials        20       44      +24     
Flag Coverage Δ
dev-backend 93.87% <ø> (ø)
dev-frontend 93.65% <80.64%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tdrs-frontend/src/components/Button/Button.jsx 100.00% <ø> (ø)
...ntend/src/components/UploadReport/UploadReport.jsx 90.62% <ø> (ø)
tdrs-frontend/src/components/Modal/Modal.jsx 72.41% <72.41%> (ø)
tdrs-frontend/src/components/Reports/Reports.jsx 91.30% <87.87%> (ø)
tdrs-frontend/src/reducers/reports.js 100.00% <0.00%> (ø)
...end/src/components/LoginCallback/LoginCallback.jsx 46.66% <0.00%> (ø)
tdrs-frontend/src/components/Routes/Routes.js 100.00% <0.00%> (ø)
tdrs-frontend/src/components/Profile/Profile.jsx 80.00% <0.00%> (ø)
tdrs-frontend/src/components/Home/Home.jsx 100.00% <0.00%> (ø)
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e0284b...e091cb3. Read the comment docs.

@andrew-jameson
Copy link
Collaborator

andrew-jameson commented Oct 27, 2022

Negative case #1:

data-files/ as Developer
Search 2022/qtr1
select file section 1
select quarter 2, don't click search
banner updates to qtr 2
select file section 2
click submit, success
check backend LogEntry, noted as Q2 for both files

Negative case #2:

data-files/ as Developer
Search 2022/qtr3
select file X section 1
submit
select quarter 4, don't click search
banner updates to qtr 2
select file Y for section 2
submit
backend notes files as:
fileX quarter 3
file Y quarter 4
does not submit fileX despite quarter 4 being selected

cc @ADPennington @reitermb Can we talk about this behavior? I feel like the error alert should force the user to reclick search.

Copy link

@raftmsohani raftmsohani left a comment

Choose a reason for hiding this comment

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

LGTM! Tested locally

handleCancel={() => setIsToggled(false)}
/>
)}
<Modal
title="Files Not Submitted"
message="Your files have not been submitted. Searching without submitting will discard your changes and remove any uploaded"

Choose a reason for hiding this comment

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

Is the message complete? Maybe "...Uploaded FILE"?

Choose a reason for hiding this comment

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

Nice catch! Probably uploaded "file(s)" to also include the possibility of multiple non-submitted files.

Copy link
Author

Choose a reason for hiding this comment

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

wow, not sure how that happened honestly. code goblins 😄

[isVisible, modalRef, buttons]
)

const onTabPressed = (shiftKey = false) => {
Copy link
Author

Choose a reason for hiding this comment

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

along with the focus() in the useEffect above, this is what "traps" the keyboard focus into the modal. the user should only be able to tab through (forward or backward by adding a shiftKey modifier`) buttons within the modal's list.

@jtimpe jtimpe requested a review from reitermb November 1, 2022 17:36
@reitermb reitermb added Deploy with CircleCI-a11y Deploy to https://tdp-frontend-a11y.app.cloud.gov through CircleCI and removed Deploy with CircleCI-a11y Deploy to https://tdp-frontend-a11y.app.cloud.gov through CircleCI labels Nov 1, 2022
Copy link

@reitermb reitermb left a comment

Choose a reason for hiding this comment

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

Looking good on focus trapping and visual z-index issues!

One last thing it still needs is an initial focus set to the modal's H1 though.
Currently the screenreader behavior results in a lack of context as to what the modal buttons are referring to.

e.g.
Modal opens
Screenreader says "Cancel"

The desired behavior here would be for focus to land on that H1 "Files Not Submitted" heading so that the behavior is:
Modal Opens
Screenreader says "Files Not Submitted"
User can then tab to buttons and have context for what they refer to


If it's not scope creeping this ticket it would be great to also give the paragraph text an ID that can then be referenced in an aria-describeby property on the modal's h1.

This would result in the screenreader user also being read the paragraph text, not just the heading text and enhance the overall clarity of the modal. That said, we can make this a follow-on issue if this adds scope (noting that this could also be an enhancement to our idle timer modal).

@jtimpe jtimpe requested a review from reitermb November 1, 2022 20:49
@jtimpe
Copy link
Author

jtimpe commented Nov 1, 2022

@reitermb thanks! i feel like we're getting close, pushed up both the requested changes. i tested the header focus change and that seems to work, but i don't have a screen reader set up to test the aria-describedby attribute. is there something you recommend?

also, thinking ahead based on the convo in tabletop, i think it'd be helpful to discuss more about these a11y rules in general so we can make sure we're designing these reusable components appropriately and planning that into the initial scope of the work.

@ADPennington
Copy link
Collaborator

@jtimpe @reitermb @ttran-hub is this ready for my review?

@ADPennington ADPennington added QASP Review and removed raft review This issue is ready for raft review Deploy with CircleCI-a11y Deploy to https://tdp-frontend-a11y.app.cloud.gov through CircleCI labels Nov 2, 2022
@ADPennington ADPennington self-requested a review November 2, 2022 16:35
@ADPennington ADPennington added the Deploy with CircleCI-qasp Deploy to https://tdp-frontend-qasp.app.cloud.gov through CircleCI label Nov 2, 2022
Copy link
Collaborator

@ADPennington ADPennington left a comment

Choose a reason for hiding this comment

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

👍🏾 confirmed the following:

  • changing selections as a data analyst or ofa admin after upload and clicking search triggers the warning modal
  • clicking cancel in the modal returns the user to the same changed selections that do not match the original selections reflected in the header description ✔️
  • clicking discard and search in the modal, discards the uploaded files and shows the user to the results of the new search. ✔️
  • if i change selections without clicking search and submit, the file submitted will have metadata that matches the header (the original selections ✔️

this is qasp- approved pending gov a11y review cc: @ttran-hub @reitermb

@ADPennington
Copy link
Collaborator

👍🏾 confirmed the following:

  • changing selections as a data analyst or ofa admin after upload and clicking search triggers the warning modal
  • clicking cancel in the modal returns the user to the same changed selections that do not match the original selections reflected in the header description ✔️
  • clicking discard and search in the modal, discards the uploaded files and shows the user to the results of the new search. ✔️
  • if i change selections without clicking search and submit, the file submitted will have metadata that matches the header (the original selections ✔️

this is qasp- approved pending gov a11y review cc: @ttran-hub @reitermb

@reitermb @ttran-hub this PR is in the qasp environment, which is only accessibly using non-acf credentials for sign-in.

Copy link

@reitermb reitermb left a comment

Choose a reason for hiding this comment

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

Working great! That should do it for everything @ttran-hub and I discussed, including the describeby stretch goal. 💯

Video of it in action:
Modal pops up
Focus reads out heading
Paragraph text gets read automatically after heading
Maintains existing focus trap to contain users to the modal

chrome_5HxmtE6VY4.mp4

cc: @ADPennington

@ADPennington
Copy link
Collaborator

Working great! That should do it for everything @ttran-hub and I discussed, including the describeby stretch goal. 💯

Video of it in action: Modal pops up Focus reads out heading Paragraph text gets read automatically after heading Maintains existing focus trap to contain users to the modal

chrome_5HxmtE6VY4.mp4
cc: @ADPennington

thanks @reitermb and @ttran-hub! @andrew-jameson this is ready to merge.

@ADPennington ADPennington added Ready to Merge and removed QASP Review Gov A11y Review Deploy with CircleCI-qasp Deploy to https://tdp-frontend-qasp.app.cloud.gov through CircleCI labels Nov 2, 2022
@reitermb
Copy link

reitermb commented Nov 2, 2022

@reitermb thanks! i feel like we're getting close, pushed up both the requested changes. i tested the header focus change and that seems to work, but i don't have a screen reader set up to test the aria-describedby attribute. is there something you recommend?

also, thinking ahead based on the convo in tabletop, i think it'd be helpful to discuss more about these a11y rules in general so we can make sure we're designing these reusable components appropriately and planning that into the initial scope of the work.

👍 Always happy to talk a11y—is there a first step kind of sync you think would be helpful there?

Re: Screenreaders, Thomas generally tests with NVDA—a popular screenreader for Windows. My main testing is a combination of that and Voiceover (for MacOS/iOS/iPadOS) with occasional Talkback (Android) testing thrown in just revisit mobile occasionally. In theory Voiceover is going to behave most consistently paired with Safari and NVDA paired with Firefox—but in practice we get consistent behavior cross-browser and cross-platform.

Pending further syncing I also have a hack.md with some broader commentary on a11y tools that might be useful: https://hackmd.io/Z5t247a7St2tZzLS35JBkw?view

@andrew-jameson andrew-jameson merged commit ec6b59c into develop Nov 3, 2022
@andrew-jameson andrew-jameson deleted the fix/992-notify-data-file-search-selection-changes branch November 3, 2022 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants