From b1d75926738db1681fba58e19339c9e87ac49564 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 15 Sep 2024 23:41:18 +0800 Subject: [PATCH] Fix hotkeys firing for multiple elements This is due to react-hotkeys-hook v4.5.1 upgrade --- src/components/modal.jsx | 2 +- src/components/status.jsx | 10 +++++----- src/components/timeline.jsx | 8 ++++---- src/pages/catchup.jsx | 8 ++++---- src/pages/notifications.jsx | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/modal.jsx b/src/components/modal.jsx index daa5a98a..d6d5f677 100644 --- a/src/components/modal.jsx +++ b/src/components/modal.jsx @@ -72,7 +72,7 @@ function Modal({ children, onClose, onClick, class: className, minimized }) {
{ modalRef.current = node; - escRef.current = node?.querySelector?.('[tabindex="-1"]') || node; + escRef(node?.querySelector?.('[tabindex="-1"]') || node); }} className={className} onClick={(e) => { diff --git a/src/components/status.jsx b/src/components/status.jsx index 4808ab9f..a386dd32 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -1519,11 +1519,11 @@ function Status({ node?.closest?.( '.timeline-item, .timeline-item-alt, .status-link, .status-focus', ) || node; - rRef.current = nodeRef; - fRef.current = nodeRef; - dRef.current = nodeRef; - bRef.current = nodeRef; - xRef.current = nodeRef; + rRef(nodeRef); + fRef(nodeRef); + dRef(nodeRef); + bRef(nodeRef); + xRef(nodeRef); }} tabindex="-1" class={`status ${ diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index ae445cba..978763bb 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -390,10 +390,10 @@ function Timeline({ }`} ref={(node) => { scrollableRef.current = node; - jRef.current = node; - kRef.current = node; - oRef.current = node; - dotRef.current = node; + jRef(node); + kRef(node); + oRef(node); + dotRef(node); }} tabIndex="-1" onClick={(e) => { diff --git a/src/pages/catchup.jsx b/src/pages/catchup.jsx index d63def71..1b56ef2b 100644 --- a/src/pages/catchup.jsx +++ b/src/pages/catchup.jsx @@ -842,10 +842,10 @@ function Catchup() {
{ scrollableRef.current = node; - jRef.current = node; - kRef.current = node; - hlRef.current = node; - escRef.current = node; + jRef(node); + kRef(node); + hlRef(node); + escRef(node); }} id="catchup-page" class="deck-container" diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index 5cace735..96d9e048 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -477,9 +477,9 @@ function Notifications({ columnMode }) { class="deck-container" ref={(node) => { scrollableRef.current = node; - jRef.current = node; - kRef.current = node; - oRef.current = node; + jRef(node); + kRef(node); + oRef(node); }} tabIndex="-1" >