mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
fix(vscode): handle contenteditable focus
This commit is contained in:
@@ -61,11 +61,14 @@ describe("Agent Manager focus", () => {
|
||||
rename.className = "am-worktree-rename-input"
|
||||
const prompt = window.document.createElement("textarea")
|
||||
prompt.className = "prompt-input"
|
||||
const editor = window.document.createElement("div")
|
||||
editor.contentEditable = "plaintext-only"
|
||||
const button = window.document.createElement("button")
|
||||
|
||||
expect(isTextControl(rename)).toBe(true)
|
||||
expect(preservesTextFocus(rename)).toBe(true)
|
||||
expect(preservesTextFocus(prompt)).toBe(false)
|
||||
expect(isTextControl(editor)).toBe(true)
|
||||
expect(isTextControl(button)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,5 +5,5 @@ export const isTextControl = (el: Element | null): boolean => {
|
||||
if (!el) return false
|
||||
if (el.tagName === "TEXTAREA" || el.tagName === "SELECT") return true
|
||||
if (el.tagName === "INPUT") return !nonText.has((el as HTMLInputElement).type.toLowerCase())
|
||||
return el.getAttribute("contenteditable") === "true" || el.getAttribute("role") === "textbox"
|
||||
return ("isContentEditable" in el && (el as HTMLElement).isContentEditable) || el.getAttribute("role") === "textbox"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user