From ca64d26d77673c50a46014193c5c3432e4313aaf Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 25 Aug 2022 09:18:36 -0400 Subject: [PATCH] fixes #871 --- docs/resources/changelog.md | 1 + src/components/tree/tree.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index b194c3b3b..f4b99163a 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -20,6 +20,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Fixed a bug in `` that prevented flip fallbacks from working as intended - Fixed a bug that caused concurrent animations to work incorrectly when the durations were different [#867](https://github.com/shoelace-style/shoelace/issues/867) - Fixed a bug in `` that caused the trigger and color preview to ignore opacity on first render [#869](https://github.com/shoelace-style/shoelace/issues/869) +- Fixed a bug in `` that prevented the keyboard from working when the component was nested in a shadow root [#871](https://github.com/shoelace-style/shoelace/issues/871) - Improved single selection in `` so nodes expand and collapse and receive selection when clicking on the label - Renamed `expanded-icon` and `collapsed-icon` slots to `expand-icon` and `collapse-icon` in the experimental `` and `` components - Improved RTL support for `` diff --git a/src/components/tree/tree.ts b/src/components/tree/tree.ts index f5c39ed68..9d88c63f4 100644 --- a/src/components/tree/tree.ts +++ b/src/components/tree/tree.ts @@ -228,7 +228,7 @@ export default class SlTree extends ShoelaceElement { if (items.length > 0) { event.preventDefault(); - const activeItemIndex = items.findIndex(item => document.activeElement === item); + const activeItemIndex = items.findIndex(item => item.matches(':focus')); const activeItem: SlTreeItem | undefined = items[activeItemIndex]; const focusItemAt = (index: number) => {