NOTE: This page is a recollection of what I've written previously. I do not guarantee it's accuracy.
The concept of a keyboard-focused widget is little more than a global reference, managed seperately by the window manager, GTK+, and WebKitGTK. Though additional logic is added to dispatch the correct events, and in GTK’s case manage the concept of a “default widget” (what is that?).
GTK tracks and dispatches to this global per window, with having received events from a callback registered to GDK for receiving events from the window manager.
And in WebKit it’s tracked by the Document, with events being received and dispatched by the EventHandler
.