From 8109dd3a85328c3be91f98e7d7b58533abbdc0b4 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 8 Mar 2022 12:57:57 -0800 Subject: [PATCH] Fix implementation of `u` key The `u` key isn't supposed to be a general purpose back key, there is a `b` command for that. The `u` key should just be used as an "up" command to go from the reader to the library. --- .../web/components/templates/article/ArticleContainer.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/web/components/templates/article/ArticleContainer.tsx b/packages/web/components/templates/article/ArticleContainer.tsx index 6d4c379b5..cbe9d85ad 100644 --- a/packages/web/components/templates/article/ArticleContainer.tsx +++ b/packages/web/components/templates/article/ArticleContainer.tsx @@ -10,7 +10,6 @@ import { MutableRefObject, useEffect, useState } from 'react' import { ReportIssuesModal } from './ReportIssuesModal' import { reportIssueMutation } from '../../../lib/networking/mutations/reportIssueMutation' import { ArticleHeaderToolbar } from './ArticleHeaderToolbar' -import Head from 'next/head' import { articleKeyboardCommands } from '../../../lib/keyboardShortcuts/navigationShortcuts' import { useKeyboardShortcuts } from '../../../lib/keyboardShortcuts/useKeyboardShortcuts' import { ShareArticleModal } from './ShareArticleModal' @@ -19,6 +18,7 @@ import { webBaseURL } from '../../../lib/appConfig' import { updateThemeLocally } from '../../../lib/themeUpdater' import { EditLabelsModal } from './EditLabelsModal' import Script from 'next/script' +import { useRouter } from 'next/router' type ArticleContainerProps = { viewerUsername: string @@ -33,6 +33,7 @@ type ArticleContainerProps = { } export function ArticleContainer(props: ArticleContainerProps): JSX.Element { + const router = useRouter() const [showShareModal, setShowShareModal] = useState(false) const [showLabelsModal, setShowLabelsModal] = useState(false) const [showNotesSidebar, setShowNotesSidebar] = useState(false) @@ -48,7 +49,7 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { } useKeyboardShortcuts( - articleKeyboardCommands(async (action) => { + articleKeyboardCommands(router, async (action) => { switch (action) { case 'openOriginalArticle': const url = props.article.url