File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
packages/kit-headless/src/components/tabs Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -527,6 +527,26 @@ describe('Tabs', () => {
527527 cy . findByRole ( 'tab' , { name : / T a b 3 / i } ) . should ( 'have.focus' ) ;
528528 } ) ;
529529
530+ it ( `GIVEN 3 horizontal tabs with the first one disabled and last one is focused
531+ WHEN triggering the right arrow key
532+ THEN the focus should be on the second tab` , ( ) => {
533+ cy . mount ( < PotentiallyDisabledThreeTabs disabledIndex = { 0 } /> ) ;
534+
535+ cy . findByRole ( 'tab' , { name : / T a b 3 / i } ) . type ( '{rightarrow}' ) ;
536+
537+ cy . findByRole ( 'tab' , { name : / T a b 2 / i } ) . should ( 'have.focus' ) ;
538+ } ) ;
539+
540+ it ( `GIVEN 3 horizontal tabs with the first one disabled and last one is focused
541+ WHEN triggering the right arrow key
542+ THEN the focus should be on the second tab` , ( ) => {
543+ cy . mount ( < PotentiallyDisabledThreeTabs disabledIndex = { 2 } /> ) ;
544+
545+ cy . findByRole ( 'tab' , { name : / T a b 2 / i } ) . type ( '{rightarrow}' ) ;
546+
547+ cy . findByRole ( 'tab' , { name : / T a b 1 / i } ) . should ( 'have.focus' ) ;
548+ } ) ;
549+
530550 it ( `GIVEN 3 tabs and the last is disabled and the focus is on the first,
531551 WHEN triggering the 'end' key
532552 THEN the focus should be on the second tab` , ( ) => {
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ export const Tabs = component$((props: TabsProps) => {
159159 ) {
160160 let nextTabId = enabledTabs [ 0 ] . tabId ;
161161
162- if ( currentFocusedTabIndex < tabPairsList . length - 1 ) {
162+ if ( currentFocusedTabIndex < enabledTabs . length - 1 ) {
163163 nextTabId = enabledTabs [ currentFocusedTabIndex + 1 ] . tabId ;
164164 }
165165 focusOnTab ( nextTabId ) ;
You can’t perform that action at this time.
0 commit comments