Merge pull request #5334 from Chic-Tweetz/fix-hintables-losing-clientRects

Check hintable elements' clientRects still exist when building hints
This commit is contained in:
Oliver Blanthorn 2026-01-28 11:40:18 +00:00 committed by GitHub
commit 405ee11d2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -503,6 +503,7 @@ export function hintPage(
reset()
return
}
modeState.hints.forEach(hint => hint.hidden = false)
// There are multiple hints. Normally we would just show all of them, but
// we try to be clever here. Automatically select the first one if all the
@ -741,7 +742,6 @@ class Hint {
this.y = window.scrollY + top
modeState.hintHost.appendChild(this.flag)
this.hidden = false
}
public static isHintable(target: Element): boolean {

View file

@ -227,6 +227,7 @@ export function isVisible(thing: Element | Range) {
thing = thing.parentElement
}
}
if (thing.getClientRects().length === 0) return false
const clientRect = thing.getBoundingClientRect()
switch (true) {
case !clientRect: