-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[TextField] Added new prop that disables spinner #3477
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
Conversation
|
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. |
65dd88a to
d82a6c5
Compare
| | 'text' | ||
| | 'decimal' | ||
| | 'numeric' | ||
| | 'numeric-no-spinner' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a valid input type, unless it's super new and I don't know about it. I'm worried it will break accessibility. Can we add a prop to hide the spinner instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Kyle! Initially, I thought about doing a prop to hide the spinner, but was told that perhaps a new type would be better? https://shopify.slack.com/archives/CQK6FNLJK/p1602612476356400 I might've misunderstood what Ben meant, thank you :)
|
An alternative approach to this change is to use Example: https://codesandbox.io/s/gracious-fire-jkckq?file=/App.js |
Thank you! I just tried it and it seems to work (partially) when the input type isn't set; without setting the input type to number, it's possible to enter letters in the field, as soon as I set the input type to number, the spinner is back |
|
Ah, ok. I think in that case you would either have to go with this change but still pass a valid number type to the underlying input. One more approach that I think I actually prefer is that if you set the |
Updated the PR with the changes suggested :) |
dfmcphee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion for the change log but otherwise this works great. Would be good to add a test for this as well.
UNRELEASED.md
Outdated
|
|
||
| ### Enhancements | ||
|
|
||
| - Added `step='0'` check to `Textfield` to disable spinner with input type 'number' ([#3477](https://github.com/Shopify/polaris-react/pull/3477)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Added `step='0'` check to `Textfield` to disable spinner with input type 'number' ([#3477](https://github.com/Shopify/polaris-react/pull/3477)) | |
| - Updated `Textfield` with a `type` of `number` to not render a spinner if step is set to `0` ([#3477](https://github.com/Shopify/polaris-react/pull/3477)) |
d398f94 to
4bfde88
Compare
dfmcphee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Looks good! Thanks for adding that.
kyledurand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this solution. Thanks @ehasrouni!
|
🎉 Thanks for your contribution to Polaris React! |
* Added new inputMode type that disables spinner * Updated unreleased.md * Fixed failing job run * Updated unreleased.md * Added "step=0" to disable spinner, reverted old changes * Changed type from string to int * Added a test following PR comment * Fixed a linting issue, added onChange to test
WHY are these changes introduced?
Fixes https://github.com/Shopify/web/pull/32659 ; In Admin and Pos Channel, we want to hide the spinner when entering a Pin (4 digit number).
WHAT is this pull request doing?
This PR doesn't display/hides the spinner if the input type is 'number' and if the step="0".

Before (top field) & After (bottom field)
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
playground/Playground.tsx:Use when input text should be a pin.
🎩 checklist
README.mdwith documentation changes