Tests if the current event seems like an intent to open a new tab. Useful for client-side navigation handling.

Type signature

({ button, ctrlKey, metaKey, shiftKey }: {
    button?: number;
    ctrlKey?: boolean;
    metaKey?: boolean;
    shiftKey?: boolean;
}) => boolean

Examples

openInNewTabIntent({
  ctrlKey: true,
});
// ⇒ true
Try in REPL

Questions

  • How to check if the user wants to open a new tab using history API?

TypeScript sourceJavaScript source