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: switch to HTML text inputs with numeric validation #4128

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jaredcwhite
Copy link
Collaborator

@jaredcwhite jaredcwhite commented Jun 11, 2024

This PR addresses metrotranscom#658

  • Addresses the issue in full
  • Addresses only certain aspects of the issue

Description

Note: see comment below

The working theory is the issue with numbers changing randomly in the unit editing is due to input type="number" weirdness around mouse/trackpad scrolling. This PR switches to input type="text" and uses React Hook Form validation to verify integer input.

How Can This Be Tested/Reviewed?

Try editing units for a listing, income, or the miles radius on preferences.

Author Checklist:

  • Added QA notes to the issue with applicable URLs
  • Reviewed in a desktop view
  • Reviewed in a mobile view
  • Reviewed considering accessibility
  • Added tests covering the changes
  • Made corresponding changes to the documentation
  • Ran yarn generate:client and/or created a migration when required

Review Process:

  • Read and understand the issue
  • Ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Either (1) explicitly ask a clarifying question, (2) request changes, or (3) approve the PR, even if there are very small remaining changes, if you don't need to re-review after the updates

Copy link

netlify bot commented Jun 11, 2024

Deploy Preview for bloom-exygy-dev ready!

Name Link
🔨 Latest commit 68c56f0
🔍 Latest deploy log https://app.netlify.com/sites/bloom-exygy-dev/deploys/667f0d83aee826000813b2a7
😎 Deploy Preview https://deploy-preview-4128--bloom-exygy-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jaredcwhite
Copy link
Collaborator Author

Cypress test failing seems to just be a glitch

@jaredcwhite jaredcwhite added the 1 review needed Requires 1 more review before ready to merge label Jun 11, 2024
@@ -700,10 +700,10 @@ const PreferenceDrawer = ({
name="radiusSize"
label={t("settings.preferenceValidatingAddress.howManyMiles")}
register={register}
validation={{ required: true, min: 0 }}
validation={{ required: true, min: 0, pattern: /^[0-9.]+$/ }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What might min do here now that it's text?

Copy link
Collaborator

@emilyjablonski emilyjablonski left a comment

Choose a reason for hiding this comment

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

After this change, I'm able to type letters into these numeric inputs, which I think we ideally want to avoid.

@emilyjablonski emilyjablonski added needs changes The author must make changes and then re-request review before merging and removed 1 review needed Requires 1 more review before ready to merge labels Jun 12, 2024
Copy link

netlify bot commented Jun 17, 2024

Deploy Preview for partners-bloom-dev ready!

Name Link
🔨 Latest commit 68c56f0
🔍 Latest deploy log https://app.netlify.com/sites/partners-bloom-dev/deploys/667f0d834ae13700086188a9
😎 Deploy Preview https://deploy-preview-4128--partners-bloom-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jaredcwhite jaredcwhite force-pushed the 658/text-inputs-with-validation branch from 597b000 to 68c56f0 Compare June 28, 2024 19:22
@jaredcwhite jaredcwhite added 1 review needed Requires 1 more review before ready to merge and removed needs changes The author must make changes and then re-request review before merging labels Jun 28, 2024
@jaredcwhite
Copy link
Collaborator Author

I've updated the PR with a combination of currency-specific fields and text fields with numeric validation. Only the currency fields expressively forbid typing letters, and they also have the byproduct of forcing decimal places (aka 500.00 rather than 500) which I'm concerned by cause trickle-down issues with display in other places. So…I'm not entirely sure we should consider this mergable without a broader convo.

@emilyjablonski emilyjablonski added on hold Temporarily paused work and removed 1 review needed Requires 1 more review before ready to merge labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold Temporarily paused work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants