-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Numberfield followup #1029
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
Numberfield followup #1029
Conversation
Mostly a save point, but this starts to address style issues Labels the field correctly Adds some stories Moves specs because it's more complicated and easier to read on its own
…t cover active/hover states buttons are now on the right side
Don't allow values less than the min or greater than the max Add many TODO's Use NaN in to be a little more explicit about what's happening, plus it's a number Fix a lot of tests, remove a lot of v2 tests because we're pretty different than v2
|
Build successful! 🎉 |
Fix labels Add label test
|
Build successful! 🎉 |
# Conflicts: # packages/@react-aria/numberfield/src/useNumberField.ts # packages/@react-spectrum/numberfield/test/NumberField.test.js
|
Build successful! 🎉 |
move focus from stepper buttons back to the input when they are pressed
…layed in the input
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.
- NumberField does not announce value change when either the increment or decrement value is pressed. This is because the NumberField is not considered focused when either the Increment or Decrement button has focus:
See:
react-spectrum/packages/@react-aria/spinbutton/src/useSpinButton.ts
Lines 112 to 124 in 0ac271a
| let onFocus = () => { | |
| isFocused.current = true; | |
| }; | |
| let onBlur = () => { | |
| isFocused.current = false; | |
| }; | |
| useEffect(() => { | |
| if (isFocused.current) { | |
| announce(textValue || `${value}`); | |
| } | |
| }, [textValue, value]); |
Should the Increment and Decrement buttons also have onFocus and onBlur handlers?
- MouseDown on the Increment or Decrement button should shift focus to the textfield, but on a mobile device, TouchStart should keep focus on the Increment or Decrement button. With this behavior and live region announcement on input, a mobile screen reader user can set focus to increment or decrement button, and continue pressing the button, receiving feedback for each value change, without focus shifting to the input and opening the on screen keyboard.
it now reads 'Empty' instead of 50% for an empty field, this is a POC
|
Build successful! 🎉 |
move translation string into aria
|
Build successful! 🎉 |
FF should support everything we want Safari has a decimal point on iOS
|
Build successful! 🎉 |
|
Build successful! 🎉 |
Add types Remove a few options from some of our API's to reduce surface area Separate rounding from clamping Simplify rounding via the formatter
|
Build successful! 🎉 |
Fix spinning when starting with a not undefined min/max Fix tests Only parse when the actual input or formatter (parser) changes
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| let state = useNumberFieldState(props); | ||
|
|
||
| let {locale} = useLocale(); | ||
| let [currentNumeralSystem, setCurrentNumeralSystem] = useState<NumeralSystem | undefined>(); |
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.
Should this be in stately? Seems weird to pass it around as a prop, especially the setter.
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.
So reason for this is that I need access to the current numeral system before I useNumberFormatter, which I have to create in NumberField and pass into the state
| textValue?: string | ||
| } | ||
|
|
||
| // I don't know how to remove this one so it's not duplicated and not being imported from aria, should it be in react-types? shared? |
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.
Yeah should go in types. I guess shared is fine? Otherwise we'd need to create a whole new i18n types package... we do have a locale.d.ts file in there already 🤔
|
FYI pinged about a couple old unresolved threads too in case you don't see them :) Happy for them to be follow ups if you want but just let me know |
# Conflicts: # packages/@react-stately/color/src/useHexColorFieldState.ts
|
Build successful! 🎉 |
…ly live in stately yet
|
Build successful! 🎉 |
|
Build successful! 🎉 |
Closes #853 #908 #852 #1132 #1133
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: