Add tabindex to DurationInput

This commit is contained in:
Justin Edmund 2023-06-17 19:13:30 -07:00
parent c66d688936
commit 33c7e7b28c

View file

@ -14,7 +14,10 @@ interface Props
} }
const DurationInput = React.forwardRef<HTMLInputElement, Props>( const DurationInput = React.forwardRef<HTMLInputElement, Props>(
function DurationInput({ className, value, onValueChange }, forwardedRef) { function DurationInput(
{ className, value, onValueChange, ...props },
forwardedRef
) {
// State // State
const [duration, setDuration] = useState('') const [duration, setDuration] = useState('')
const [minutesSelected, setMinutesSelected] = useState(false) const [minutesSelected, setMinutesSelected] = useState(false)
@ -191,6 +194,7 @@ const DurationInput = React.forwardRef<HTMLInputElement, Props>(
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder="mm" placeholder="mm"
size={3} size={3}
tabIndex={props.tabIndex}
/> />
<span>:</span> <span>:</span>
<Input <Input
@ -208,6 +212,7 @@ const DurationInput = React.forwardRef<HTMLInputElement, Props>(
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder="ss" placeholder="ss"
size={2} size={2}
tabIndex={props.tabIndex ? props.tabIndex + 1 : undefined}
/> />
</div> </div>
) )