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.
This commit is contained in:
Mick O'Brien 2024-04-26 12:23:53 +01:00
parent 7376cb1e99
commit 5ae2058c07

View file

@ -209,8 +209,8 @@ function Timeline({
const oRef = useHotkeys(['enter', 'o'], () => { const oRef = useHotkeys(['enter', 'o'], () => {
// open active status // open active status
const activeItem = document.activeElement.closest(itemsSelector); const activeItem = document.activeElement;
if (activeItem) { if (activeItem?.matches(itemsSelector)) {
activeItem.click(); activeItem.click();
} }
}); });