Repository navigation
Conversation
Member
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 What kind of change does this PR introduce?
🔗 Related Issue
Self-discovered bug. No matching issue or fix PR was found during the pre-submission search.
💡 Background and solution
The global
/search shortcut checksdocument.activeElementto avoid intercepting text input. For an editor inside an open shadow root, this points to the shadow host instead of the editor. The shortcut therefore callspreventDefault()and opens search while the user is typing. This also affects the search component's own shadow-root input.Check the keyboard event's composed path for editable elements before handling
/, while retaining the existing active-element guard. No public API or dependency changes are required.Reproduction
td-doc-searchmounted, focus an input inside an open shadow root.a/b./is prevented and the global search shortcut fires. After this fix,a/bstays in the editor without activating the shortcut.The screenshots below use a minimal page importing the actual
registerHotkeys()helper. Its open callback focuses a separate search input, making accidental shortcut activation visible.Validation
pnpm run testpassed, including coverage (6 files, 26 tests).pnpm run typecheck,pnpm run lintandpnpm run buildpassed inpackages/site-components. The build includes Less compilation.git diff --checkpassed.a/bremains in the shadow-root editor; Ctrl+K, Escape and/outside an editor still work. Meta+K is covered by unit tests.📝 Changelog
fix(site-components): Allow typing
/in open Shadow DOM editors without triggering the global search shortcut.This PR does not need a changelog entry.
☑️ Checklist before requesting a merge