Fix: [AEA-5942] - multi role select error#1921
Open
jonathanwelch1-nhs wants to merge 3 commits intomainfrom
Open
Fix: [AEA-5942] - multi role select error#1921jonathanwelch1-nhs wants to merge 3 commits intomainfrom
jonathanwelch1-nhs wants to merge 3 commits intomainfrom
Conversation
Contributor
|
This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket: AEA-5942 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a multi-role selection issue by preventing repeated role-selection submissions and visually/behaviorally disabling other role cards during selection, while also tightening up button disabled handling and correcting a UI string.
Changes:
- Add selection “in progress” state to prevent multiple role selection submissions and disable other role cards.
- Ensure
ReactRouterButtoncorrectly respects and forwards thedisabledprop. - Add role-selection page SCSS for disabled/selected card/link styling and fix a capitalization issue in a UI string.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/cpt-ui/src/styles/roleselectionpage.scss | Adds styles for disabled/unselectable cards and maintains selected card link styling. |
| packages/cpt-ui/src/constants/ui-strings/YourSelectedRoleStrings.ts | Fixes capitalization in “Current role details” label. |
| packages/cpt-ui/src/components/ReactRouterButton.tsx | Prevents navigation/click handling when disabled and forwards disabled to NHS button component. |
| packages/cpt-ui/src/components/EpsRoleSelectionPage.tsx | Introduces isSelectingRole/selectedCardId state to block repeated submissions and disable other cards during selection; imports new SCSS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+382
to
+389
| onClick={isOtherCardDisabled ? | ||
| (e) => e.preventDefault() : | ||
| (e) => handleCardClick(e, roleCardProps) | ||
| } | ||
| onKeyDown={isOtherCardDisabled ? | ||
| undefined : | ||
| (e) => handleCardKeyDown(e, roleCardProps) | ||
| } |
Comment on lines
+395
to
+399
| }} | ||
| tabIndex={isOtherCardDisabled ? -1 : 0} | ||
| aria-disabled={isOtherCardDisabled} | ||
| role="button" | ||
| className={`${ |
Comment on lines
+119
to
+126
| // Prevent multiple submissions | ||
| if (isSelectingRole) { | ||
| return | ||
| } | ||
|
|
||
| setIsSelectingRole(true) | ||
| setSelectedCardId(roleCardProps.uuid) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove items from this list if they are not relevant. Remove this line once this has been done
Details
Add any summary information of what is in the change. Remove this line if you have nothing to add.
Pull Request Naming
Pull requests should be named using the following format:
Tag can be one of:
Fix- for a bug fix. (Patch release)Update- either for a backwards-compatible enhancement or for a rule change that adds reported problems. (Patch release)New- implemented a new feature. (Minor release)Breaking- for a backwards-incompatible enhancement or feature. (Major release)Docs- changes to documentation only. (Patch release)Build- changes to build process only. (No release)Upgrade- for a dependency upgrade. (Patch release)Chore- for refactoring, adding tests, etc. (anything that isn't user-facing). (Patch release)If the current release is x.y.z then
Correct tagging is necessary for our automated versioning and release process.
The description of your pull request will be used as the commit message for the merge, and also be included in the changelog. Please ensure that your title is sufficiently descriptive.
Rerunning Checks
If you need to rename your pull request, you can restart the checks by either:
git commit --allow-empty -m 'trigger build' git pushRerunning the checks from within the pull request will not use the updated title.