mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Fix lastinput for shadowdoms
This commit is contained in:
parent
12fcc25efe
commit
790cee1f95
1 changed files with 6 additions and 3 deletions
|
@ -541,6 +541,7 @@ export function getLastUsedInput(): HTMLElement {
|
||||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=1406825
|
* https://bugzilla.mozilla.org/show_bug.cgi?id=1406825
|
||||||
* */
|
* */
|
||||||
function onPageFocus(elem: HTMLElement): boolean {
|
function onPageFocus(elem: HTMLElement): boolean {
|
||||||
|
elem = elem.shadowRoot ? elem.shadowRoot.activeElement as HTMLElement : elem
|
||||||
if (isTextEditable(elem)) {
|
if (isTextEditable(elem)) {
|
||||||
LAST_USED_INPUT = elem
|
LAST_USED_INPUT = elem
|
||||||
}
|
}
|
||||||
|
@ -578,9 +579,11 @@ function hijackPageFocusFunction(): void {
|
||||||
export function setupFocusHandler(): void {
|
export function setupFocusHandler(): void {
|
||||||
// Handles when a user selects an input
|
// Handles when a user selects an input
|
||||||
document.addEventListener("focusin", e => {
|
document.addEventListener("focusin", e => {
|
||||||
if (isTextEditable(e.target as HTMLElement)) {
|
let elem = e.target as HTMLElement
|
||||||
LAST_USED_INPUT = e.target as HTMLElement
|
elem = elem.shadowRoot ? elem.shadowRoot.activeElement as HTMLElement : elem
|
||||||
setInput(e.target as HTMLInputElement)
|
if (isTextEditable(elem)) {
|
||||||
|
LAST_USED_INPUT = elem
|
||||||
|
setInput(elem)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Handles when the page tries to select an input
|
// Handles when the page tries to select an input
|
||||||
|
|
Loading…
Add table
Reference in a new issue