We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abbec2d commit 47604ccCopy full SHA for 47604cc
site/src/components/CodeExample/CodeExample.tsx
@@ -23,7 +23,11 @@ export const CodeExample: FC<CodeExampleProps> = ({
23
}) => {
24
const buttonRef = useRef<HTMLButtonElement>(null);
25
const triggerButton = (event: KeyboardEvent | MouseEvent) => {
26
- if (event.target !== buttonRef.current) {
+ const clickTriggeredOutsideButton =
27
+ event.target instanceof HTMLElement &&
28
+ !buttonRef.current?.contains(event.target);
29
+
30
+ if (clickTriggeredOutsideButton) {
31
buttonRef.current?.click();
32
}
33
};
0 commit comments