File tree Expand file tree Collapse file tree 5 files changed +29
-2
lines changed
Expand file tree Collapse file tree 5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,10 @@ import { useTranslation } from "react-i18next";
1313
1414interface BasicInfoStepProps {
1515 errors : Record < string , string > ;
16+ onForceNext ?: ( ) => void ;
1617}
1718
18- export function BasicInfoStep ( { errors } : BasicInfoStepProps ) {
19+ export function BasicInfoStep ( { errors, onForceNext } : BasicInfoStepProps ) {
1920 const {
2021 draftConfig,
2122 setDraftConfig,
@@ -213,6 +214,12 @@ export function BasicInfoStep({ errors }: BasicInfoStepProps) {
213214 onChange = { ( e ) =>
214215 setDraftConfig ( { ...draftConfig , max_tnt : e . target . value } )
215216 }
217+ onKeyDown = { ( e ) => {
218+ if ( e . key === "Tab" && ! e . shiftKey ) {
219+ e . preventDefault ( ) ;
220+ onForceNext ?.( ) ;
221+ }
222+ } }
216223 placeholder = { errors . max_tnt }
217224 className = { cn (
218225 "h-7 text-xs font-mono px-2 py-0 shadow-none" ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ interface CompactInputProps {
1313 labelClassName ?: string ;
1414 error ?: string ;
1515 suffix ?: React . ReactNode ;
16+ id ?: string ;
1617}
1718
1819export function CompactInput ( {
@@ -23,6 +24,7 @@ export function CompactInput({
2324 labelClassName,
2425 error,
2526 suffix,
27+ id,
2628} : CompactInputProps ) {
2729 const [ localValue , setLocalValue ] = React . useState ( value . toString ( ) ) ;
2830 const [ isFocused , setIsFocused ] = React . useState ( false ) ;
@@ -62,6 +64,7 @@ export function CompactInput({
6264 onFocus = { ( ) => setIsFocused ( true ) }
6365 onBlur = { ( ) => setIsFocused ( false ) }
6466 placeholder = { error }
67+ id = { id }
6568 />
6669 </ div >
6770 { suffix && (
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ export function TNTConfigurationStep({ errors }: TNTConfigurationStepProps) {
7070 hasError = { ! ! errors . red_tnt_selection }
7171 xSign = "-"
7272 zSign = "-"
73+ inputIdX = "tnt-config-start-input"
7374 />
7475 < TNTInputGroup
7576 title = { t ( "configuration_page.ne_tnt" ) }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ interface TNTInputGroupProps {
1515 yOffset ?: number ;
1616 xSign ?: string ;
1717 zSign ?: string ;
18+ inputIdX ?: string ;
1819}
1920
2021export function TNTInputGroup ( {
@@ -29,6 +30,7 @@ export function TNTInputGroup({
2930 yOffset = 0 ,
3031 xSign,
3132 zSign,
33+ inputIdX,
3234} : TNTInputGroupProps ) {
3335 const { t } = useTranslation ( ) ;
3436 let yValue : string | number = data . y ;
@@ -90,6 +92,7 @@ export function TNTInputGroup({
9092 </ span >
9193 )
9294 }
95+ id = { inputIdX }
9396 />
9497 < CompactInput
9598 label = { t ( "configuration_page.label_y" ) }
Original file line number Diff line number Diff line change @@ -81,6 +81,16 @@ export default function Configuration() {
8181
8282 const progress = count > 0 ? ( current / count ) * 100 : 0 ;
8383
84+ const handleForceNext = ( ) => {
85+ if ( validateStep ( current ) ) {
86+ api ?. scrollNext ( ) ;
87+ setTimeout ( ( ) => {
88+ const nextInput = document . getElementById ( "tnt-config-start-input" ) ;
89+ nextInput ?. focus ( ) ;
90+ } , 300 ) ;
91+ }
92+ } ;
93+
8494 if ( ! isConfiguring ) {
8595 return (
8696 < OnboardingPanel
@@ -148,7 +158,10 @@ export default function Configuration() {
148158 < CarouselContent className = "h-full" >
149159 < CarouselItem className = "h-full" >
150160 < ScrollArea className = "h-full" >
151- < BasicInfoStep errors = { errors } />
161+ < BasicInfoStep
162+ errors = { errors }
163+ onForceNext = { handleForceNext }
164+ />
152165 </ ScrollArea >
153166 </ CarouselItem >
154167 < CarouselItem className = "h-full" >
You can’t perform that action at this time.
0 commit comments