Make ;; hint mode change scrolling element

This commit is contained in:
Oliver Blanthorn 2020-05-25 10:16:17 +01:00
parent df73304b1d
commit e0ed570a99
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 7 additions and 1 deletions

View file

@ -153,6 +153,11 @@ let currentFocused = document.activeElement as any
let lastX = 0
let lastY = 0
// export let currentFocused exports it as readonly, so we have to write a function
export function setCurrentFocus(v) {
currentFocused = v
}
document.addEventListener("mousedown", event => {
currentFocused = event.target
})

View file

@ -3780,7 +3780,7 @@ export function setnull(...keys: string[]) {
- -S save the linked image
- -a save-as the linked resource
- -A save-as the linked image
- -; focus an element
- -; focus an element and set it as the element or the child of the element to scroll
- -# yank an element's anchor URL to clipboard
- -c [selector] hint links that match the css selector
- `bind ;c hint -c [class*="expand"],[class="togg"]` works particularly well on reddit and HN
@ -4070,6 +4070,7 @@ export async function hint(option?: string, selectors?: string, ...rest: string[
hinting.hintables(selectors),
elem => {
elem.focus()
scrolling.setCurrentFocus(elem)
return elem
},
rapid,