Skip to content

Commit 910f972

Browse files
authored
fix: ensure button click is executed after kolFocus in PopoverButtonB… (#8749)
2 parents 67b4bf8 + 1a5b172 commit 910f972

File tree

1 file changed

+7
-2
lines changed
  • packages/samples/react/src/components/popover-button

1 file changed

+7
-2
lines changed

packages/samples/react/src/components/popover-button/basic.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ export const PopoverButtonBasic: FC = () => {
99
const buttonRef = React.useRef<HTMLKolPopoverButtonElement>(null);
1010

1111
useEffect(() => {
12-
buttonRef.current?.kolFocus();
13-
// es muesste noch ein Klick ausgefuehrt werden
12+
const run = async () => {
13+
await buttonRef.current?.kolFocus();
14+
if (buttonRef.current instanceof HTMLButtonElement) {
15+
buttonRef.current.click();
16+
}
17+
};
18+
run();
1419
}, []);
1520

1621
const dummyEventHandler = {

0 commit comments

Comments
 (0)