diff --git a/docs/src/modules/components/AppTableOfContents.js b/docs/src/modules/components/AppTableOfContents.js index e32069e18c5ae4..dcdb4affcef377 100644 --- a/docs/src/modules/components/AppTableOfContents.js +++ b/docs/src/modules/components/AppTableOfContents.js @@ -198,7 +198,19 @@ export default function AppTableOfContents(props) { // Corresponds to 10 frames at 60 Hz useThrottledOnScroll(itemsServer.length > 0 ? findActiveIndex : null, 166); - const handleClick = hash => () => { + const handleClick = hash => event => { + // Ignore click for new tab/new window behavior + if ( + event.defaultPrevented || + event.button !== 0 || // ignore everything but left-click + event.metaKey || + event.ctrlKey || + event.altKey || + event.shiftKey + ) { + return; + } + // Used to disable findActiveIndex if the page scrolls due to a click clickedRef.current = true; unsetClickedRef.current = setTimeout(() => { diff --git a/docs/src/modules/components/MarkdownLinks.js b/docs/src/modules/components/MarkdownLinks.js index 084ee494b41a28..098aab649af57c 100644 --- a/docs/src/modules/components/MarkdownLinks.js +++ b/docs/src/modules/components/MarkdownLinks.js @@ -9,8 +9,8 @@ export async function handleEvent(event, as) { event.button !== 0 || // ignore everything but left-click event.metaKey || event.ctrlKey || - event.shiftKey || - (event.nativeEvent && event.nativeEvent.which === 2) + event.altKey || + event.shiftKey ) { return; }