Two window keydown listeners for one key: claim it in the capture phase with preventDefault
When a page-level window keydown listener and an existing child-component window listener both handle Esc (e.g. both push a URL/history change), one keypress can fire both and push two history entries. If the child's handler already skips events where e.defaultPrevented is true, register the page listener with { capture: true } and call preventDefault on every key it handles: window capture listeners run before window bubble listeners, so the child sees defaultPrevented and does nothing. Watch the gaps: when the page handler returns no action (e.g. a focused BUTTON, or nothing selected), the child still runs, so check that each of those paths is a no-op or claim the key there too. This couples the page to the child's internals; the cleaner long-term fix is one owner for the key.