You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on an input element based on DbInput (in react). Here is a simplified version:
import{ChangeEvent,useEffect,useRef,}from"react";import"@db-ui/core/dist/css/01-elements/input/input.css";import{DbInput}from"@db-ui/react-elements";interfaceCustomInputProps{label: string;onChange: (value: string)=>void;value: string;name: string;}constCustomInput: React.FC<CustomInputProps>=({label, name, onChange, value})=>{functioncleanInput(inputValue: string){// Here the user input is cleaned, for instance by removing invalid charactersreturndoSomething(inputValue);;}functionhandleChange(event: ChangeEvent<HTMLDbInputElement>){if(event.target.value!==undefined){onChange(cleanInput(event.target.value))}}return(<DbInputtype="text"label={label}name={name}value={value}onInput={handleChange}/>)}exportdefaultCustomInput;
In this example, when a user enters something, their input is cleaned, then sent to the parent, which updates the value prop.
If I replace the DbInput with a standard HTML input Element, this works as intended. Only the cleaned input content appears in the input field. For the user, it looks like their invalid input was ignored.
However, with DbInput, the visible value is never updated from the value Prop, which effectively ignores the "clean" step and displays everything the user inputs, including invalid characters. This does not work with a local state either - DbInput seems to only read the value once, then ignore subsequent updates.
My understanding is that DbInput should behave like a regular Input. If so, this is definitely a bug. Could you please take a look?
Best regards
Nicolas
The text was updated successfully, but these errors were encountered:
Hello,
I am working on an input element based on DbInput (in react). Here is a simplified version:
In this example, when a user enters something, their input is cleaned, then sent to the parent, which updates the
value
prop.If I replace the
DbInput
with a standard HTMLinput
Element, this works as intended. Only the cleaned input content appears in the input field. For the user, it looks like their invalid input was ignored.However, with DbInput, the visible value is never updated from the
value
Prop, which effectively ignores the "clean" step and displays everything the user inputs, including invalid characters. This does not work with a local state either - DbInput seems to only read the value once, then ignore subsequent updates.My understanding is that DbInput should behave like a regular Input. If so, this is definitely a bug. Could you please take a look?
Best regards
Nicolas
The text was updated successfully, but these errors were encountered: