1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! `:focus-visible` heuristics — when the UA makes focus evident
//! (Selectors 4 §13.2). rdom-core keeps the bit
//! ([`Dom::focus_visible`](rdom_core::Dom::focus_visible)) and matches
//! the selector; this module decides it from input modality, following
//! the browsers (and the WICG `focus-visible` polyfill they converged
//! on):
//!
//! - a key press without Ctrl / Alt / Super (typing, Tab, arrows, Enter
//! — not a shortcut chord) makes the focus evident, both the current
//! focus and whatever the key moves it to ([`note_key`]);
//! - focus moved by a pointer event is evident only on an element that
//! takes keyboard input — a text control or editing host
//! ([`TuiNodeExt::is_editable`]) — so a clicked button, toggle or
//! select shows no indicator while a clicked text field does
//! ([`pointer_focus_is_evident`]). Both decisions land before the
//! focus events fire, as in browsers: [`note_key`] runs before the key
//! is routed, and the router's focus-on-press commits the answer with
//! the focus; [`note_pointer_focus`] settles focus a pointer event's
//! listener moved by script;
//! - focus moved by script outside an input event leaves the bit alone,
//! so it keeps the previously focused element's visibility, as the
//! spec asks; script focus from a click handler counts as pointer
//! focus.
//!
//! A pointer press that does not move focus leaves the bit alone, as in
//! browsers: the element keeps the visibility it was focused with.
use ;
use NodeId;
use crateTuiDom;
use crateTuiNodeExt;
/// A key press (or repeat) without Ctrl / Alt / Super is keyboard use:
/// the focus becomes evident.
pub
/// Focus moved onto `id` by a pointer event is evident iff `id` takes
/// keyboard input. The router's focus-on-press commits this with the
/// focus ([`focus_node_by_pointer`](super::focus_node_by_pointer)), so
/// `focus` listeners see it.
pub
/// After a pointer event: if it moved focus off `before` onto an
/// element, that focus is evident iff the element takes keyboard input.
/// Covers script focus from a pointer event's listener (a `click`
/// handler's `focus()`), which the router's own focus path does not
/// see; that focus's own listeners ran before this correction.
pub