refactor(bundle-size): use free-function helpers for events and timers#541
Open
layershifter wants to merge 4 commits into
Open
refactor(bundle-size): use free-function helpers for events and timers#541layershifter wants to merge 4 commits into
layershifter wants to merge 4 commits into
Conversation
\`patch-package\` postinstall hook applies three changes to keyborg@2.14.0 covering both the ESM (\`dist/index.js\`) and CJS (\`dist/index.cjs\`) bundles: 1. \`event.details = details\` — drop the \`@deprecated\` alias of \`event.detail\`. Tabster reads \`e.detail\` exclusively (verified across src/State/FocusedElement.ts and the rest of the codebase). 2. \`triggerKeys\` / \`dismissKeys\` props + the supporting \`shouldDismiss\` / \`scheduleDismiss\` / \`dismissTimer\` machinery. Tabster only ever calls \`createKeyborg(getWindow())\` with no props. 3. \`canOverrideNativeFocus\` runtime probe. Replaces the \`_canOverrideNativeFocus\` flag with the implicit-true assumption modern browsers (everything since IE9) already satisfy. The conditional \`details.isFocusedProgrammatically\` write becomes unconditional — semantically identical when override works. Bundle deltas (createTabster default-mode): keyborg slice: 3.71 → 3.12 kB (-590 B, -16%) createTabster: 30.78 → 30.18 kB (-600 B) getModalizer: 38.47 → 37.87 kB (-600 B) getMover: 44.54 → 43.94 kB (-600 B) getCrossOrigin: 89.64 → 89.04 kB (-600 B) allExports: 92.09 → 91.50 kB (-590 B) Tests pass: 3 pre-existing failures, no regressions across default, uncontrolled, and root-dummy-inputs modes. Stop-gap until upstream microsoft/keyborg can release the same trims (the changes belong there, not as a Tabster-side fork). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📊 Bundle size report🤖 This report was generated against a579ebbd50e37f1565551549fe57bbc9ddafab64 |
This was referenced May 11, 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
Replaces inline boilerplate at every call site with shared free-function helpers in
Utils.ts:addListener/removeListenerforaddEventListener/removeEventListenerwith optionsdispatchEventforel.dispatchEvent(new XEvent(...))setTimer/createTimer/ free-functionTimerAPI replacing rawsetTimeout/clearTimeoutboilerplateThese compress better than open-coded calls because the helper name mangles once and references shrink everywhere.
Stack context
Stacked on top of #540. Net new in this PR: the four helper introductions and their call-site sweeps.