SIGN IN SIGN UP

input: Clear a stale focused_input left by an input removed while focused (#2818)

## Summary

`Root.focused_input` is maintained from the input's render:
`sync_focused_input_registry` records the state while its handle is
focused, and unregisters it on the first render after focus moves away.
An input removed from the tree while still focused never renders again,
so the unregister branch never runs — the registration outlives the
input, and `has_focused_input` answers true for the whole window until a
dialog close happens to reset the field.

Validate the registration when it is read: `focused_input` now answers
`None` — and lazily clears the field — once the registered handle is no
longer the window's focus. `has_focused_input` goes through the same
path. The identity guard leaves a registration made by another input in
the meantime untouched.

No public API change, so no breaking changes.

## Test Plan

- `focused_input_registry_ignores_input_removed_while_focused` — new,
failing before this change: focus an input, remove it from the tree and
move focus elsewhere in the same update, then assert the window reports
no focused input.
- `cargo test -p gpui-component` — full lib suite passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
F
Floyd Wang committed
c27f5d5c8f70d534978c2f0739ad9e10d4e41eb4
Parent: 9d2ac9e
Committed by GitHub <noreply@github.com> on 8/24/2026, 11:06:53 AM