From 5ae2058c07983d01454f473c0f3dd1548c0f4132 Mon Sep 17 00:00:00 2001 From: Mick O'Brien Date: Fri, 26 Apr 2024 12:23:53 +0100 Subject: [PATCH] Fix `enter` keyboard shortcut on timeline Currently pressing `enter` opens the active status if the status or any focusable child of the status is focused e.g. the avatar or a link. I think it should only open the post details when the post itself is focused. --- src/components/timeline.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index 6fe1273c..13f8a59b 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -209,8 +209,8 @@ function Timeline({ const oRef = useHotkeys(['enter', 'o'], () => { // open active status - const activeItem = document.activeElement.closest(itemsSelector); - if (activeItem) { + const activeItem = document.activeElement; + if (activeItem?.matches(itemsSelector)) { activeItem.click(); } });