From f8d7360647ef4eac9e005fca6d32aca8ccf3a074 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Thu, 10 Oct 2024 13:10:24 -0500 Subject: [PATCH] Do not set shouldFocusCard on new highlight (#2350) * Reset shouldFocusCard on new highlight * shouldFocusCard is false on new highlight --------- Co-authored-by: staxly[bot] <35789409+staxly[bot]@users.noreply.github.com> --- .../content/highlights/components/CardWrapper.tsx | 4 ++-- yarn.lock | 15 +-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/app/content/highlights/components/CardWrapper.tsx b/src/app/content/highlights/components/CardWrapper.tsx index fd56d6c8220..4769d00b66d 100644 --- a/src/app/content/highlights/components/CardWrapper.tsx +++ b/src/app/content/highlights/components/CardWrapper.tsx @@ -50,9 +50,9 @@ const Wrapper = ({highlights, className, container, highlighter}: WrapperProps) if (element.current.contains(activeElement)) { focusedHighlight.focus(); } else { - setShouldFocusCard(true); + setShouldFocusCard(focusedId !== undefined); } - }, [element, focusedHighlight]); + }, [focusedHighlight, focusedId]); useKeyCombination(highlightKeyCombination, moveFocus, noopKeyCombinationHandler([container, element])); diff --git a/yarn.lock b/yarn.lock index ef9e2023c67..ac8cb97a43d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10244,20 +10244,7 @@ electron-to-chromium@^1.4.431, electron-to-chromium@^1.5.4: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== -elliptic@^6.0.0: - version "6.5.7" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.7.tgz#8ec4da2cb2939926a1b9a73619d768207e647c8b" - integrity sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -elliptic@^6.5.5: +elliptic@^6.0.0, elliptic@^6.5.5: version "6.5.7" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.7.tgz#8ec4da2cb2939926a1b9a73619d768207e647c8b" integrity sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==