Skip to content

Conversation

@snowystinger
Copy link
Member

@snowystinger snowystinger commented Aug 28, 2020

Closes #853 #908 #852 #1132 #1133

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

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
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@emircado emircado mentioned this pull request Sep 4, 2020
5 tasks
# Conflicts:
#	packages/@react-aria/numberfield/src/useNumberField.ts
#	packages/@react-spectrum/numberfield/test/NumberField.test.js
@adobe-bot
Copy link

Build successful! 🎉

move focus from stepper buttons back to the input when they are pressed
Copy link
Collaborator

@majornista majornista left a comment

Choose a reason for hiding this comment

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

  1. 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:

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?

  1. 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.

@adobe-bot
Copy link

Build successful! 🎉

move translation string into aria
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

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
@adobe-bot
Copy link

Build successful! 🎉

Fix spinning when starting with a not undefined min/max
Fix tests
Only parse when the actual input or formatter (parser) changes
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

let state = useNumberFieldState(props);

let {locale} = useLocale();
let [currentNumeralSystem, setCurrentNumeralSystem] = useState<NumeralSystem | undefined>();
Copy link
Member

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.

Copy link
Member Author

@snowystinger snowystinger Jan 16, 2021

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?
Copy link
Member

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 🤔

@devongovett
Copy link
Member

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
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@devongovett devongovett merged commit bd1afa1 into main Jan 20, 2021
@devongovett devongovett deleted the numberfield-followup branch January 20, 2021 19:03
@snowystinger snowystinger mentioned this pull request Jan 20, 2021
12 tasks
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.

NumberField should support labels

6 participants