fix(mobile): close the details card when you touch the terminal (#38823)

* fix(mobile): close the details card when a touch lands outside it

Co-authored-by: zhangxaochen <3416677+zhangxaochen@users.noreply.github.com>

* fix(mobile): explain the pointerdown listener and drop a focus check that can't fail

---------

Co-authored-by: zhangxaochen <3416677+zhangxaochen@users.noreply.github.com>
This commit is contained in:
Kelvin Amoaba
2026-11-09 20:12:31 +00:00
committed by GitHub
co-authored by zhangxaochen
parent 1d92f6fcdb
commit 4783b08ae5
@@ -47,7 +47,7 @@ export function useDetailCardScope({
record.restore = false
dismiss()
}
const click = (event: MouseEvent) => {
const press = (event: MouseEvent) => {
if (!inside(event.target) && !headerBack(event.target)) {
outside()
}
@@ -120,7 +120,9 @@ export function useDetailCardScope({
}
}
const capture = { capture: true, signal: listeners.signal }
document.addEventListener('click', click, capture)
// Why: the terminal claims its touches, so iOS sends no click for a tap there.
document.addEventListener('pointerdown', press, capture)
document.addEventListener('click', press, capture)
document.addEventListener('keydown', key, capture)
document.addEventListener('keyup', key, capture)
document.addEventListener('keydown', isolate, { signal: listeners.signal })