[patched] - Pointer Focus Registration Code
Instead of:
# 3. Notify old focus (asynchronous, allow cleanup) if old_focus and old_focus != candidate: old_focus.on_pointer_focus_lost(event)
occurs when pointer focus registers and releases multiple times within a single frame—usually due to overlapping transparent hitboxes or async layout recalculations. pointer focus registration code
Your users’ pointers—and your sanity—will thank you. Have your own focus war story? The comments are open. Bring logs.
The best systems make pointer focus invisible. The worst make it unforgettable. Instead of: # 3
is the exclusive right of a single UI element to receive input events originating from a pointing device (mouse, pen, touch). Unlike keyboard focus (which can be transferred via Tab ), pointer focus is transient, aggressive, and inherently tied to geometry and z-order.
Be the former.
If you’re building a new UI system today, to application code. Abstract it. Or suffer the consequences. Closing Thoughts Pointer focus registration is a 40-year-old problem that we still solve badly. Every modal dialog that steals focus while you’re typing? That’s a registration bug. Every click that falls into the void between scrolling frames? Also a registration bug.