From 1f0891ad05c1581ce16132873642b482ea47bb22 Mon Sep 17 00:00:00 2001 From: MohamadSalman11 Date: Fri, 17 Jan 2025 15:06:54 +0100 Subject: [PATCH] Fix keyboard navigation for contenteditable elements --- js/src/dropdown.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 96094a3e6577..5fd4b0852635 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -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 }