Skip to content

UDS-1933: feat(app-rfi): added a patch for react-phone-input-2 #1470

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

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

juanmitriatti
Copy link
Contributor

@juanmitriatti juanmitriatti commented Feb 11, 2025

UDS-1933

Rearrange components in react-phone-input-2 to improve accessibility, making navigation and usage easier for users with disabilities.

Test Steps:

  1. Pull the branch.
  2. Run yarn command in the source directory in order to install dependencies and apply patch.
  3. Navigate to the app-rfi folder and run the command:

yarn storybook

Verification:

Ensure that when using the Tab key for navigation, the focus first lands on the flag input before the phone number input.

Form :
http://localhost:XXXX/?path=/story/uds-asurfi--default

Solution added to the library :

To resolve this ticket, which required adding a custom patch to the UDS project, I followed these steps in the React phone library code:

Solution - Technical steps :

yarn patch
Yarn patch <package> This command will cause a package to be extracted in a temporary directory intended to be editable at will.

Once you're done with your changes, run yarn [patch-commit](https://yarnpkg.com/cli/patch-commit) -s path (with path being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the patch: protocol. Run yarn patch-commit -h for more details.

Description

Links

@juanmitriatti juanmitriatti requested a review from a team as a code owner February 11, 2025 18:14
@davidornelas11
Copy link
Contributor

Lerna fails to build because it is not recognizing the yarn patch. Might have to do with yarn hoisting. Might have to be something we look into @scott-williams-az
https://yarnpkg.com/configuration/yarnrc#nmHoistingLimits

@@ -84,7 +84,7 @@
"@asu/unity-react-core": "workspace:^",
"formik": "^2.1.4",
"prop-types": "^15.7.2",
"react-phone-input-2": "^2.14.0",
"react-phone-input-2": "patch:react-phone-input-2@npm%3A2.15.1#~/.yarn/patches/react-phone-input-2-npm-2.15.1-f7a7dd913b.patch",
"reactstrap": "^9",
Copy link
Contributor

Choose a reason for hiding this comment

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

Try this:
./package.json resolutions have to be at the workspace root

{
  ...
  "dependencies": {
    ...
   },
   "resolutions": {
      "react-phone-input-2": "patch:react-phone-input-2@npm%3A2.15.1#~/.yarn/patches/react-phone-input-2-npm-2.15.1-f7a7dd913b.patch"
   },
}

./packages/app-rfi/package.json since our patch is for 2.15.1 remove the ^ and set the exact version

{
  ...
  "dependencies": {
    ...
    "react-phone-input-2": "2.15.1",
    ...
   },
}

@asu-jenkins-devops
Copy link
Collaborator

@juanmitriatti
Copy link
Contributor Author

Hi @scott-williams-az
Good morning. PR has been updated based on your feedback. It seems to be working now.
Thanks
CC @mlsamuelson @davidornelas11

Copy link
Contributor

@davidornelas11 davidornelas11 left a comment

Choose a reason for hiding this comment

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

The build runs and the phone input works as expected. The initial country code is first selected when tabbing then after the choice is made, the normal number input can be tabbed to. Approved

@davidornelas11 davidornelas11 merged commit 26bf946 into dev Mar 5, 2025
1 check passed
@davidornelas11 davidornelas11 deleted the UDS-1933 branch March 5, 2025 21:11
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