Pure DOM-focus helpers extracted from input-handler.ts so they're
unit-testable against a real DOM (no mocks needed) and can be reused
by other input components.
Both helpers operate on a passed-in Element | null rather than
reading document.activeElement directly, so callers control the
DOM context and tests don't have to programmatically focus elements
to assert behaviour.
Pure DOM-focus helpers extracted from input-handler.ts so they're unit-testable against a real DOM (no mocks needed) and can be reused by other input components.
Both helpers operate on a passed-in
Element | nullrather than readingdocument.activeElementdirectly, so callers control the DOM context and tests don't have to programmatically focus elements to assert behaviour.