@codeleap/web 3.18.4 → 3.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -136,20 +136,22 @@ export const SegmentedControl = (props: SegmentedControlProps) => {
|
|
|
136
136
|
]
|
|
137
137
|
|
|
138
138
|
const onSelectTab = (option: SegmentedControlOptionProps, e?: React.KeyboardEvent<HTMLDivElement>) => {
|
|
139
|
-
if (
|
|
139
|
+
if (!e || e?.keyCode === 13 || e?.key === 'Enter') {
|
|
140
|
+
if (!debounceEnabled || !TypeGuards.isNumber(debounce)) {
|
|
141
|
+
onValueChange(option.value)
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (sectionPressedRef.current !== null) return
|
|
140
146
|
|
|
141
|
-
if (!debounceEnabled || !TypeGuards.isNumber(debounce)) {
|
|
142
147
|
onValueChange(option.value)
|
|
143
|
-
|
|
148
|
+
sectionPressedRef.current = setTimeout(() => {
|
|
149
|
+
clearTimeout(sectionPressedRef.current)
|
|
150
|
+
sectionPressedRef.current = null
|
|
151
|
+
}, debounce)
|
|
152
|
+
} else {
|
|
153
|
+
return null
|
|
144
154
|
}
|
|
145
|
-
|
|
146
|
-
if (sectionPressedRef.current !== null) return
|
|
147
|
-
|
|
148
|
-
onValueChange(option.value)
|
|
149
|
-
sectionPressedRef.current = setTimeout(() => {
|
|
150
|
-
clearTimeout(sectionPressedRef.current)
|
|
151
|
-
sectionPressedRef.current = null
|
|
152
|
-
}, debounce)
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
return (
|