Skip to content

Commit

Permalink
Fix dblClick issue on website
Browse files Browse the repository at this point in the history
  • Loading branch information
diegohaz committed May 30, 2023
1 parent 3f8df09 commit 95d8a2a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions website/app/layout.tsx
Expand Up @@ -26,6 +26,19 @@ window.addEventListener("storage", (event) => {
});
`;

// See https://github.com/facebook/react/issues/19841#issuecomment-694978234
const dblClickWorkaround = `
if (typeof window !== "undefined") {
const addEventListener = Node.prototype.addEventListener;
Node.prototype.addEventListener = function (type, callback, options) {
if (type === "dblclick" && (options === true || options === false)) {
return;
}
return addEventListener.call(this, type, callback, options);
};
}
`;

const inter = Inter({ subsets: ["latin"] });

export function generateMetadata() {
Expand All @@ -37,6 +50,7 @@ export default function Layout({ children }: PropsWithChildren) {
<html lang="en" suppressHydrationWarning className={inter.className}>
<body suppressHydrationWarning>
<script dangerouslySetInnerHTML={{ __html: darkModeScript }} />
<script dangerouslySetInnerHTML={{ __html: dblClickWorkaround }} />
{children}
<Analytics />
</body>
Expand Down

1 comment on commit 95d8a2a

@vercel
Copy link

@vercel vercel bot commented on 95d8a2a May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ariakit – ./

ariakit-git-main-ariakit.vercel.app
ariakit-ariakit.vercel.app
www.ariakit.org
ariakit.org

Please sign in to comment.