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

Input: Support controlled functionality

Open silvalaura opened this issue 1 year ago • 0 comments

Describe the bug I want to control the value of Input to make it not less than 0 and not bigger than 23. But looks like a component starts being uncontrolled on the fly when It meets my condition in the handler for the first time

To Reproduce Example with native <input />: https://codesandbox.io/p/sandbox/angry-bhaskara-p8knqq?file=%2Fsrc%2FApp.js%3A23%2C27 Example with RM input: https://codesandbox.io/p/sandbox/react-magma-example-forked-djn3dr?file=%2Fexample.tsx%3A25%2C30

Expected behavior An input can be controlled

Additional context The way that it’s currently built, it doesn’t support that kind of behavior because of this line: https://github.com/cengage/react-magma/blob/dev/packages/react-magma-dom/src/components/InputBase/index.tsx#L622.

silvalaura avatar May 16 '24 14:05 silvalaura