chore: drop canOverrideNativeFocus runtime probe#177
Open
layershifter wants to merge 1 commit into
Open
Conversation
The `canOverrideNativeFocus` helper detected whether reassigning `HTMLElement.prototype.focus` was respected by the browser. The check was guarding against pre-IE9 behaviour where prototype overrides were ignored. Every browser keyborg currently supports honours the override, so the `_canOverrideNativeFocus` flag is effectively always true after the first call. Replace the conditional `details.isFocusedProgrammatically` write with an unconditional one — semantically identical when the override works, which is the only case we still ship for — and drop the probe entirely. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📊 Bundle size reportUnchanged fixtures
|
mshoho
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
canOverrideNativeFocuswas a feature-detection helper that temporarily reassignedHTMLElement.prototype.focusto a no-op, called.focus()on a synthetic button, and checked whether the override fired. The result was cached in the module-level_canOverrideNativeFocusflag and gated thedetails.isFocusedProgrammaticallywrite insidesetupFocusEvent.The probe guarded against pre-IE9 environments where prototype-level focus overrides were ignored. Every browser keyborg currently supports honours the override, so the flag is effectively always true after the first call.
Drops:
canOverrideNativeFocusfunction (~17 lines of synthetic-button-focus dance),_canOverrideNativeFocusflag,setupFocusEvent.The gated
isFocusedProgrammaticallywrite becomes unconditional:Semantically identical when the override works, which is the only case still in scope.
Public API impact
None.
canOverrideNativeFocuswas module-private;_canOverrideNativeFocuswas a module-private variable.🤖 Generated with Claude Code