File tree Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Expand file tree Collapse file tree 4 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
- Use correct value when resetting ` <Listbox multiple> ` and ` <Combobox multiple> ` ([ #2626 ] ( https://github.com/tailwindlabs/headlessui/pull/2626 ) )
13
13
- Render ` <MainTreeNode /> ` in ` Popover.Group ` component only ([ #2634 ] ( https://github.com/tailwindlabs/headlessui/pull/2634 ) )
14
14
- Disable smooth scrolling when opening/closing ` Dialog ` components on iOS ([ #2635 ] ( https://github.com/tailwindlabs/headlessui/pull/2635 ) )
15
+ - Don't assume ` <Tab /> ` components are available when setting the next index ([ #2642 ] ( https://github.com/tailwindlabs/headlessui/pull/2642 ) )
15
16
16
17
## [ 1.7.16] - 2023-07-27
17
18
Original file line number Diff line number Diff line change @@ -114,12 +114,14 @@ let reducers: {
114
114
return nextState
115
115
}
116
116
117
+ let nextSelectedIndex = match ( direction , {
118
+ [ Direction . Forwards ] : ( ) => tabs . indexOf ( focusableTabs [ 0 ] ) ,
119
+ [ Direction . Backwards ] : ( ) => tabs . indexOf ( focusableTabs [ focusableTabs . length - 1 ] ) ,
120
+ } )
121
+
117
122
return {
118
123
...nextState ,
119
- selectedIndex : match ( direction , {
120
- [ Direction . Forwards ] : ( ) => tabs . indexOf ( focusableTabs [ 0 ] ) ,
121
- [ Direction . Backwards ] : ( ) => tabs . indexOf ( focusableTabs [ focusableTabs . length - 1 ] ) ,
122
- } ) ,
124
+ selectedIndex : nextSelectedIndex === - 1 ? state . selectedIndex : nextSelectedIndex ,
123
125
}
124
126
}
125
127
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
- Use correct value when resetting ` <Listbox multiple> ` and ` <Combobox multiple> ` ([ #2626 ] ( https://github.com/tailwindlabs/headlessui/pull/2626 ) )
14
14
- Render ` <MainTreeNode /> ` in ` PopoverGroup ` component only ([ #2634 ] ( https://github.com/tailwindlabs/headlessui/pull/2634 ) )
15
15
- Disable smooth scrolling when opening/closing ` Dialog ` components on iOS ([ #2635 ] ( https://github.com/tailwindlabs/headlessui/pull/2635 ) )
16
+ - Don't assume ` <Tab /> ` components are available when setting the next index ([ #2642 ] ( https://github.com/tailwindlabs/headlessui/pull/2642 ) )
16
17
17
18
## [ 1.7.15] - 2023-07-27
18
19
Original file line number Diff line number Diff line change @@ -130,10 +130,13 @@ export let TabGroup = defineComponent({
130
130
}
131
131
)
132
132
133
- selectedIndex . value = match ( direction , {
133
+ let nextSelectedIndex = match ( direction , {
134
134
[ Direction . Forwards ] : ( ) => tabs . indexOf ( focusableTabs [ 0 ] ) ,
135
135
[ Direction . Backwards ] : ( ) => tabs . indexOf ( focusableTabs [ focusableTabs . length - 1 ] ) ,
136
136
} )
137
+ if ( nextSelectedIndex !== - 1 ) {
138
+ selectedIndex . value = nextSelectedIndex
139
+ }
137
140
api . tabs . value = tabs
138
141
api . panels . value = panels
139
142
}
You can’t perform that action at this time.
0 commit comments