Repository navigation
fix(extension): speed up floating button placement - #36
Merged
Merged
Conversation
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.
Intent
The developer wanted to fix severe lag in the Chrome extension on heavy sites like x.com by removing complex hitbox/collision logic they suspected was too expensive. They specifically asked to replace the sophisticated hitbox behavior with something dumb and simple, accepting a less precise overlap-avoidance tradeoff. The goal was to keep button placement lightweight, avoid expensive repeated hit-testing on hot events like typing and selection changes, and verify the change with tests.
What Changed
Risk Assessment
✅ Low: The change is narrowly scoped to replacing expensive button overlap scans with a center-point hit test and includes focused test coverage for the new behavior, with no material regressions found in the reviewed diff.
Testing
Focused content-script tests, rebuilt extension bundles, and the browser e2e fixture all passed; the Playwright run exercised the actual Chrome extension UI and captured screenshots plus placement measurements showing the Simple Words button avoids a real page button while accepting overlap with a broad tabindex container as the intended simpler tradeoff.
/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KT29ZCR1PNQAN2D8EWS67H52/button-control-avoided.png)/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KT29ZCR1PNQAN2D8EWS67H52/tabindex-container-not-avoided.png)Evidence: Placement measurement evidence
buttonControlEvidence.overlapsAvoidTarget=false; tabindexEvidence.overlapsAvoidTarget=truePipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
src/content.ts:601-elementFromPointonly sees the topmost element, and the Simple Words button is made visible beforepositionButtonruns. On later input/scroll/selection refreshes, a candidate that overlaps the current button will hit-test the injected button itself, returnfalseviaisInjectedUITarget, and never inspect the page control underneath. This lets newly appeared or shifted page buttons remain covered; use a single-pointelementsFromPointscan that skips injected UI, or temporarily disable/hide the injected button while hit-testing.🔧 Fix: Skip injected UI in hit-testing
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npx vitest run test/content.test.tsnpm run build:background && npm run build:pagesnpx playwright test e2e/button-overlap.spec.ts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.