Open AshotN opened 5 months ago
@AshotN did you find a solution to this?
@dziraf please can you have a look at this?
No, I haven't found a solution. It's still a problem for me.
@AshotN I managed to get around it using useRef by doing the following:
<Modal>
<Input
ref={amountRef}
required
type='number'
value={amount}
onChange={event => {
setAmount(parseFloat(event.target.value))
setTimeout(() => {
amountRef.current.focus()
}, 0)
}}
disabled={type == 'SERVICE'}
></Input>
</Modal>
However, this hack does not work for CurrencyInput.
@dziraf do you intend to solve this bug anytime soon? CurrencyInput is very important to us.
Ya that's a bit hacky, but probably a good stop gap. Hoping there is a proper fix soon.
Contact Details
No response
What happened?
I am using a custom component that is a modal with an input field in it. Every
onChange
event causes a re-render and the input loses focus.Bug prevalence
Often
AdminJS dependencies version
What browsers do you see the problem on?
Firefox
Relevant log output
No response
Relevant code that's giving you issues