blob: dd13b92a3edf0740a342c2a8301932864197ed0a [file] [log] [blame] [view]
Erik Chen6e4c8b52021-09-03 17:54:541The terms "activation" and "focus" are often used in the chromium code base with
2different semantics depending on platform [windows, macOS, etc.] or component
3[e.g. views, blink]. For legacy reasons, sometimes even in a given component
4[e.g. views] the semantics are unclear.
5
6The goal of this document is to outline the intended definition of these terms.
7This is not a one-size fits all solution. It fails to capture some
8platform-specific nuances -- e.g. key vs main windows on macOS -- but it
9provides a common lexicon for discussion.
10
11Activation: Only applies to windows - boundary that applies to focusable
12elements.
13
14Focus: Only applies to leaf controls - Keyboard focus is sent and generally
15processed by the targeted leaf element.
16
17Activation and focus are not interchangeable. Windows are required to managed
18focus within themselves (adjusting as necessary, even when not activated!).
19Likewise, each tab/web-contents remembers its focused leaf control, even when
20the tab is not showing because it's backgrounded.
21
22Focusing a window is not a valid concept -- usually the intention is activation.
23
24Focusing a control within a window is fine, and will also activate the window.
25
26Activating a window brings it to the front, and gives the window priority [but
27not exclusivity] for handling input events.
28