bits-ui 1.0.0-next.10 → 1.0.0-next.11
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This logic is adapted from Radix UI
|
|
2
|
+
* This logic is adapted from Radix UI Select component.
|
|
3
3
|
* https://github.com/radix-ui/primitives/blob/main/packages/react/select/src/Select.tsx
|
|
4
4
|
* Credit to the Radix UI team for the original implementation.
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This logic is adapted from Radix UI
|
|
2
|
+
* This logic is adapted from Radix UI Select component.
|
|
3
3
|
* https://github.com/radix-ui/primitives/blob/main/packages/react/select/src/Select.tsx
|
|
4
4
|
* Credit to the Radix UI team for the original implementation.
|
|
5
5
|
*/
|
|
@@ -17,7 +17,6 @@ import { afterTick } from "../../internal/after-tick.js";
|
|
|
17
17
|
import { clamp } from "../../internal/clamp.js";
|
|
18
18
|
import { noop } from "../../internal/callbacks.js";
|
|
19
19
|
import { addEventListener } from "../../internal/events.js";
|
|
20
|
-
import { sleep } from "../../internal/sleep.js";
|
|
21
20
|
import { afterSleep } from "../../internal/after-sleep.js";
|
|
22
21
|
export const OPEN_KEYS = [kbd.SPACE, kbd.ENTER, kbd.ARROW_UP, kbd.ARROW_DOWN];
|
|
23
22
|
export const SELECTION_KEYS = [" ", kbd.ENTER];
|
|
@@ -81,7 +80,8 @@ export class SelectRootState {
|
|
|
81
80
|
const node = this.triggerNode;
|
|
82
81
|
if (!node)
|
|
83
82
|
return;
|
|
84
|
-
|
|
83
|
+
// this needs to be 10 otherwise Firefox doesn't focus the correct node
|
|
84
|
+
afterSleep(10, () => {
|
|
85
85
|
node.focus({ preventScroll });
|
|
86
86
|
});
|
|
87
87
|
};
|