Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyboard navigation for contenteditable elements #41157

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix keyboard navigation for contenteditable elements
  • Loading branch information
MohamadSalman11 committed Jan 17, 2025
commit 1f0891ad05c1581ce16132873642b482ea47bb22
3 changes: 2 additions & 1 deletion js/src/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,13 @@ class Dropdown extends BaseComponent {
const isInput = /input|textarea/i.test(event.target.tagName)
const isEscapeEvent = event.key === ESCAPE_KEY
const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)
const isContentEditable = event.target.closest('[contenteditable]') !== null

if (!isUpOrDownEvent && !isEscapeEvent) {
return
}

if (isInput && !isEscapeEvent) {
if ((isInput || isContentEditable) && !isEscapeEvent) {
return
}

Expand Down
Loading