react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

fix: add number type in value

Open uniqueeest opened this issue 1 year ago • 1 comments

Closes https://github.com/adobe/react-spectrum/issues/6628

✅ 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:

uniqueeest avatar Jun 27 '24 14:06 uniqueeest

@snowystinger @yihuiliao thx! Corrections are complete.

uniqueeest avatar Jun 28 '24 15:06 uniqueeest

Unfortunately I think this is a breaking change. People would need to update their types in a lot of places, as shown in the examples here.

Also, input values are always strings in the DOM (see MDN), and even in React's docs. I'm not sure why @types/react allows numbers. The value will be coerced to a string in the DOM anyway, so the value in onChange will always be a string no matter what. We could allow that but IMO it's kinda weird so sticking with strings everywhere is probably the clearest about what's actually happening.

devongovett avatar Jun 18 '25 21:06 devongovett