From 8c653f764052268a07c6de89475a3385312f7965 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Mon, 1 Jun 2026 12:18:38 -0700 Subject: [PATCH 1/4] fix(extension): speed up button collision checks --- src/content.ts | 138 +++---------------- test/content.test.ts | 320 ++++++++----------------------------------- 2 files changed, 78 insertions(+), 380 deletions(-) diff --git a/src/content.ts b/src/content.ts index 6ecd13a..6c3dc03 100644 --- a/src/content.ts +++ b/src/content.ts @@ -39,9 +39,6 @@ const CLICKABLE_AVOID_SELECTOR = [ 'input[type="reset"]', 'summary' ].join(',') -const CLICKABLE_AVOID_PROXIMITY = 80 -const CLICKABLE_AVOID_INTERIOR_SAMPLE_STEP = 4 - const BRAND_GLYPH_SVG = `` const SPARKLES_SVG = `` @@ -577,8 +574,7 @@ function collisionAwareButtonPositionNearEditor(options: { const candidateRects = buttonCandidateRectsNearEditor(positionOptions) for (const candidateRect of candidateRects) { - const avoidRects = clickableAvoidRectsForCandidate(editor, candidateRect) - if (!avoidRects.some((rect) => rectsOverlap(rect, candidateRect))) { + if (!candidateCenterCoversClickable(editor, candidateRect)) { return candidateRect } } @@ -586,127 +582,33 @@ function collisionAwareButtonPositionNearEditor(options: { return candidateRects[0] } -function clickableAvoidRectsForCandidate( +// Cheap collision check: hit-test a single point at the candidate's center. +// This avoids the topmost clickable control sitting directly under the button +// without the cost of scanning every pixel of the candidate rect, which made +// repositioning sluggish on heavy pages (it runs on scroll, input, and caret +// moves). The browser's hit-testing already skips hidden/non-painted elements. +function candidateCenterCoversClickable( editor: HTMLElement, candidateRect: RectLike -): DOMRect[] { - const elementsFromPoint = document.elementsFromPoint?.bind(document) - - if (elementsFromPoint) { - const seenElements = new Set() - - for (const element of elementsFromCandidateRect( - candidateRect, - elementsFromPoint - )) { - const clickableElement = element.closest( - CLICKABLE_AVOID_SELECTOR - ) - - if (!clickableElement || seenElements.has(clickableElement)) { - continue - } - - seenElements.add(clickableElement) - - if (clickableElement === editor) { - continue - } - - if (clickableElement.contains(editor)) { - continue - } - - if (isInjectedUITarget(clickableElement)) { - continue - } - - const visibility = getComputedStyle(clickableElement).visibility - if (visibility === 'hidden' || visibility === 'collapse') { - continue - } - - const rect = clickableElement.getBoundingClientRect() - if ( - rect.width > 0 && - rect.height > 0 && - rectsOverlap(rect, candidateRect) - ) { - return [rect] - } - } - - return [] - } - - const proximityRect = expandedRect(candidateRect, CLICKABLE_AVOID_PROXIMITY) - - return Array.from( - document.querySelectorAll(CLICKABLE_AVOID_SELECTOR) - ) - .filter((element) => element !== editor) - .filter((element) => !element.contains(editor)) - .filter((element) => !isInjectedUITarget(element)) - .filter((element) => { - const visibility = getComputedStyle(element).visibility - return visibility !== 'hidden' && visibility !== 'collapse' - }) - .map((element) => element.getBoundingClientRect()) - .filter((rect) => rect.width > 0 && rect.height > 0) - .filter((rect) => rectsOverlap(rect, proximityRect)) -} - -function* elementsFromCandidateRect( - rect: RectLike, - elementsFromPoint: (x: number, y: number) => Element[] -): Iterable { - const right = rect.right - 1 - const bottom = rect.bottom - 1 - const centerX = Math.floor(rect.left + rect.width / 2) - - for (let x = rect.left; x < rect.right; x += 1) { - yield* elementsFromPoint(x, rect.top) - yield* elementsFromPoint(x, bottom) +): boolean { + const elementFromPoint = document.elementFromPoint?.bind(document) + if (!elementFromPoint) { + return false } - for (let y = rect.top + 1; y < bottom; y += 1) { - yield* elementsFromPoint(rect.left, y) - yield* elementsFromPoint(right, y) - yield* elementsFromPoint(centerX, y) + const centerX = candidateRect.left + candidateRect.width / 2 + const centerY = candidateRect.top + candidateRect.height / 2 + const element = elementFromPoint(centerX, centerY) + if (!(element instanceof Element)) { + return false } - for ( - let x = rect.left + CLICKABLE_AVOID_INTERIOR_SAMPLE_STEP; - x < right; - x += CLICKABLE_AVOID_INTERIOR_SAMPLE_STEP - ) { - if (x === centerX) { - continue - } - - for ( - let y = rect.top + CLICKABLE_AVOID_INTERIOR_SAMPLE_STEP; - y < bottom; - y += CLICKABLE_AVOID_INTERIOR_SAMPLE_STEP - ) { - yield* elementsFromPoint(x, y) - } + const clickable = element.closest(CLICKABLE_AVOID_SELECTOR) + if (!clickable || clickable === editor || clickable.contains(editor)) { + return false } -} -function expandedRect(rect: RectLike, amount: number): DOMRect { - return new DOMRect( - rect.left - amount, - rect.top - amount, - rect.width + amount * 2, - rect.height + amount * 2 - ) -} - -function rectsOverlap(a: RectLike, b: RectLike): boolean { - return ( - a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top - ) + return !isInjectedUITarget(clickable) } function buttonSizeForEditor(rect: DOMRect): number { diff --git a/test/content.test.ts b/test/content.test.ts index 30897d3..0990d90 100644 --- a/test/content.test.ts +++ b/test/content.test.ts @@ -9,6 +9,7 @@ describe('content script button visibility', () => { document.getElementById('simplewords-panel')?.remove() vi.restoreAllMocks() Reflect.deleteProperty(document, 'elementsFromPoint') + Reflect.deleteProperty(document, 'elementFromPoint') Reflect.deleteProperty(globalThis, 'chrome') resetExtensionContextForTests() }) @@ -86,7 +87,7 @@ describe('content script button visibility', () => { expect(button.innerHTML).toContain('font-size="48"') }) - test('moves the Simple Words button away from overlapping page buttons', () => { + test('moves the Simple Words button away from a page button under its default position', () => { document.body.innerHTML = '' @@ -103,7 +104,7 @@ describe('content script button visibility', () => { y: 100, toJSON: () => null }) - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue({ + const sendRect = { top: 160, left: 260, right: 310, @@ -113,6 +114,17 @@ describe('content script button visibility', () => { x: 260, y: 160, toJSON: () => null + } + vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) + Object.defineProperty(document, 'elementFromPoint', { + configurable: true, + value: (x: number, y: number) => + x >= sendRect.left && + x < sendRect.right && + y >= sendRect.top && + y < sendRect.bottom + ? sendButton + : null }) editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) @@ -124,7 +136,7 @@ describe('content script button visibility', () => { expect(button.style.left).toBe('268px') }) - test('does not avoid invisible page buttons near the editor', () => { + test('does not avoid an invisible page button under its default position', () => { document.body.innerHTML = '' @@ -141,7 +153,7 @@ describe('content script button visibility', () => { y: 100, toJSON: () => null }) - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue({ + const sendRect = { top: 160, left: 260, right: 310, @@ -151,6 +163,20 @@ describe('content script button visibility', () => { x: 260, y: 160, toJSON: () => null + } + vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) + // Real hit-testing never returns a visibility:hidden element, so the + // mock mirrors that: the hidden button is invisible to elementFromPoint. + Object.defineProperty(document, 'elementFromPoint', { + configurable: true, + value: (x: number, y: number) => + getComputedStyle(sendButton).visibility !== 'hidden' && + x >= sendRect.left && + x < sendRect.right && + y >= sendRect.top && + y < sendRect.bottom + ? sendButton + : null }) editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) @@ -162,15 +188,12 @@ describe('content script button visibility', () => { expect(button.style.left).toBe('268px') }) - test('does not measure distant page buttons while positioning', () => { + test('does not avoid a non-clickable focusable container under its default position', () => { document.body.innerHTML = - '' + '
Focusable wrapper
' const editor = document.querySelector('textarea') as HTMLTextAreaElement - const nearButton = document.querySelector( - '[data-near]' - ) as HTMLButtonElement - const farButton = document.querySelector('[data-far]') as HTMLButtonElement + const focusableWrapper = document.querySelector('div') as HTMLDivElement vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ top: 100, left: 100, @@ -182,7 +205,7 @@ describe('content script button visibility', () => { y: 100, toJSON: () => null }) - const nearRect = { + const wrapperRect = { top: 160, left: 260, right: 310, @@ -193,126 +216,30 @@ describe('content script button visibility', () => { y: 160, toJSON: () => null } - vi.spyOn(nearButton, 'getBoundingClientRect').mockReturnValue(nearRect) - const farRectSpy = vi.spyOn(farButton, 'getBoundingClientRect') - Object.defineProperty(document, 'elementsFromPoint', { - configurable: true, - value: () => [] - }) - vi.spyOn(document, 'elementsFromPoint').mockReturnValue([nearButton]) - - editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - - expect(farRectSpy).not.toHaveBeenCalled() - const button = document.getElementById( - 'simplewords-button' - ) as HTMLButtonElement - expect(button.style.top).toBe('108px') - expect(button.style.left).toBe('268px') - }) - - test('avoids page buttons that partially overlap a candidate between sampled points', () => { - document.body.innerHTML = - '' - - const editor = document.querySelector('textarea') as HTMLTextAreaElement - const sendButton = document.querySelector('button') as HTMLButtonElement - vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ - top: 100, - left: 100, - right: 300, - bottom: 200, - width: 200, - height: 100, - x: 100, - y: 100, - toJSON: () => null - }) - const sendRect = { - top: 170, - left: 282, - right: 302, - bottom: 178, - width: 20, - height: 8, - x: 282, - y: 170, - toJSON: () => null - } - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) - Object.defineProperty(document, 'elementsFromPoint', { - configurable: true, - value: (x: number, y: number) => - x >= sendRect.left && - x < sendRect.right && - y >= sendRect.top && - y < sendRect.bottom - ? [sendButton] - : [] - }) - - editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - - const button = document.getElementById( - 'simplewords-button' - ) as HTMLButtonElement - expect(button.style.top).toBe('108px') - expect(button.style.left).toBe('268px') - }) - - test('stops overlap hit testing after finding a clear button position', () => { - document.body.innerHTML = - '' - - const editor = document.querySelector('textarea') as HTMLTextAreaElement - const sendButton = document.querySelector('button') as HTMLButtonElement - vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ - top: 100, - left: 100, - right: 300, - bottom: 200, - width: 200, - height: 100, - x: 100, - y: 100, - toJSON: () => null - }) - const sendRect = { - top: 170, - left: 282, - right: 302, - bottom: 178, - width: 20, - height: 8, - x: 282, - y: 170, - toJSON: () => null - } - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) - const elementsFromPoint = vi.fn((x: number, y: number) => - x >= sendRect.left && - x < sendRect.right && - y >= sendRect.top && - y < sendRect.bottom - ? [sendButton] - : [] + vi.spyOn(focusableWrapper, 'getBoundingClientRect').mockReturnValue( + wrapperRect ) - Object.defineProperty(document, 'elementsFromPoint', { + Object.defineProperty(document, 'elementFromPoint', { configurable: true, - value: elementsFromPoint + value: (x: number, y: number) => + x >= wrapperRect.left && + x < wrapperRect.right && + y >= wrapperRect.top && + y < wrapperRect.bottom + ? focusableWrapper + : null }) editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - expect(elementsFromPoint).toHaveBeenCalledTimes(187) const button = document.getElementById( 'simplewords-button' ) as HTMLButtonElement - expect(button.style.top).toBe('108px') + expect(button.style.top).toBe('168px') expect(button.style.left).toBe('268px') }) - test('short-circuits overlap hit testing for blocked button positions', () => { + test('checks candidate centers in order, stops at the first clear spot, and never measures page controls', () => { document.body.innerHTML = '' @@ -329,6 +256,8 @@ describe('content script button visibility', () => { y: 100, toJSON: () => null }) + // Exactly covers the default (lower-right) candidate, so the first center + // is blocked and the second is clear. const sendRect = { top: 168, left: 268, @@ -340,121 +269,26 @@ describe('content script button visibility', () => { y: 168, toJSON: () => null } - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) - const elementsFromPoint = vi.fn((x: number, y: number) => + const sendRectSpy = vi + .spyOn(sendButton, 'getBoundingClientRect') + .mockReturnValue(sendRect) + const elementFromPoint = vi.fn((x: number, y: number) => x >= sendRect.left && x < sendRect.right && y >= sendRect.top && y < sendRect.bottom - ? [sendButton] - : [] + ? sendButton + : null ) - Object.defineProperty(document, 'elementsFromPoint', { - configurable: true, - value: elementsFromPoint - }) - - editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - - expect(elementsFromPoint).toHaveBeenCalledTimes(135) - const button = document.getElementById( - 'simplewords-button' - ) as HTMLButtonElement - expect(button.style.top).toBe('108px') - expect(button.style.left).toBe('268px') - }) - - test('avoids small page buttons that overlap between sampled rows and columns', () => { - document.body.innerHTML = - '' - - const editor = document.querySelector('textarea') as HTMLTextAreaElement - const sendButton = document.querySelector('button') as HTMLButtonElement - vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ - top: 100, - left: 100, - right: 300, - bottom: 200, - width: 200, - height: 100, - x: 100, - y: 100, - toJSON: () => null - }) - const sendRect = { - top: 170, - left: 278, - right: 282, - bottom: 174, - width: 4, - height: 4, - x: 278, - y: 170, - toJSON: () => null - } - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) - Object.defineProperty(document, 'elementsFromPoint', { - configurable: true, - value: (x: number, y: number) => - x >= sendRect.left && - x < sendRect.right && - y >= sendRect.top && - y < sendRect.bottom - ? [sendButton] - : [] - }) - - editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - - const button = document.getElementById( - 'simplewords-button' - ) as HTMLButtonElement - expect(button.style.top).toBe('108px') - expect(button.style.left).toBe('268px') - }) - - test('avoids small page buttons fully inside a candidate away from sampled lines', () => { - document.body.innerHTML = - '' - - const editor = document.querySelector('textarea') as HTMLTextAreaElement - const sendButton = document.querySelector('button') as HTMLButtonElement - vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ - top: 100, - left: 100, - right: 300, - bottom: 200, - width: 200, - height: 100, - x: 100, - y: 100, - toJSON: () => null - }) - const sendRect = { - top: 176, - left: 276, - right: 280, - bottom: 180, - width: 4, - height: 4, - x: 276, - y: 176, - toJSON: () => null - } - vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) - Object.defineProperty(document, 'elementsFromPoint', { + Object.defineProperty(document, 'elementFromPoint', { configurable: true, - value: (x: number, y: number) => - x >= sendRect.left && - x < sendRect.right && - y >= sendRect.top && - y < sendRect.bottom - ? [sendButton] - : [] + value: elementFromPoint }) editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) + expect(elementFromPoint).toHaveBeenCalledTimes(2) + expect(sendRectSpy).not.toHaveBeenCalled() const button = document.getElementById( 'simplewords-button' ) as HTMLButtonElement @@ -462,44 +296,6 @@ describe('content script button visibility', () => { expect(button.style.left).toBe('268px') }) - test('does not avoid broad tabindex containers near the editor', () => { - document.body.innerHTML = - '
Focusable wrapper
' - - const editor = document.querySelector('textarea') as HTMLTextAreaElement - const focusableWrapper = document.querySelector('div') as HTMLDivElement - vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ - top: 100, - left: 100, - right: 300, - bottom: 200, - width: 200, - height: 100, - x: 100, - y: 100, - toJSON: () => null - }) - vi.spyOn(focusableWrapper, 'getBoundingClientRect').mockReturnValue({ - top: 160, - left: 260, - right: 310, - bottom: 210, - width: 50, - height: 50, - x: 260, - y: 160, - toJSON: () => null - }) - - editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) - - const button = document.getElementById( - 'simplewords-button' - ) as HTMLButtonElement - expect(button.style.top).toBe('168px') - expect(button.style.left).toBe('268px') - }) - test('uses the editable root when input events come from a contenteditable child', () => { document.body.innerHTML = '
rough reply
' From 16fb592877a4c2b058e206ca89b3f0e0d1227867 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Mon, 1 Jun 2026 12:23:49 -0700 Subject: [PATCH 2/4] no-mistakes(review): Skip injected UI in hit-testing --- src/content.ts | 28 +++++++++++---------- test/content.test.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 13 deletions(-) diff --git a/src/content.ts b/src/content.ts index 6c3dc03..d74936f 100644 --- a/src/content.ts +++ b/src/content.ts @@ -591,24 +591,26 @@ function candidateCenterCoversClickable( editor: HTMLElement, candidateRect: RectLike ): boolean { - const elementFromPoint = document.elementFromPoint?.bind(document) - if (!elementFromPoint) { - return false - } - const centerX = candidateRect.left + candidateRect.width / 2 const centerY = candidateRect.top + candidateRect.height / 2 - const element = elementFromPoint(centerX, centerY) - if (!(element instanceof Element)) { - return false - } + const elements = document.elementsFromPoint?.(centerX, centerY) ?? [ + document.elementFromPoint?.(centerX, centerY) + ] - const clickable = element.closest(CLICKABLE_AVOID_SELECTOR) - if (!clickable || clickable === editor || clickable.contains(editor)) { - return false + for (const element of elements) { + if (!(element instanceof Element) || isInjectedUITarget(element)) { + continue + } + + const clickable = element.closest(CLICKABLE_AVOID_SELECTOR) + if (!clickable || clickable === editor || clickable.contains(editor)) { + return false + } + + return !isInjectedUITarget(clickable) } - return !isInjectedUITarget(clickable) + return false } function buttonSizeForEditor(rect: DOMRect): number { diff --git a/test/content.test.ts b/test/content.test.ts index 0990d90..8b376fe 100644 --- a/test/content.test.ts +++ b/test/content.test.ts @@ -136,6 +136,66 @@ describe('content script button visibility', () => { expect(button.style.left).toBe('268px') }) + test('looks past the visible Simple Words button when checking for covered page buttons', () => { + document.body.innerHTML = + '' + + const editor = document.querySelector('textarea') as HTMLTextAreaElement + const sendButton = document.querySelector('button') as HTMLButtonElement + vi.spyOn(editor, 'getBoundingClientRect').mockReturnValue({ + top: 100, + left: 100, + right: 300, + bottom: 200, + width: 200, + height: 100, + x: 100, + y: 100, + toJSON: () => null + }) + const sendRect = { + top: 168, + left: 268, + right: 292, + bottom: 192, + width: 24, + height: 24, + x: 268, + y: 168, + toJSON: () => null + } + vi.spyOn(sendButton, 'getBoundingClientRect').mockReturnValue(sendRect) + const hitsDefaultCandidate = (x: number, y: number) => + x >= sendRect.left && + x < sendRect.right && + y >= sendRect.top && + y < sendRect.bottom + Object.defineProperty(document, 'elementFromPoint', { + configurable: true, + value: (x: number, y: number) => { + const button = document.getElementById('simplewords-button') + return button && hitsDefaultCandidate(x, y) ? button : null + } + }) + Object.defineProperty(document, 'elementsFromPoint', { + configurable: true, + value: (x: number, y: number) => { + const button = document.getElementById('simplewords-button') + return button && hitsDefaultCandidate(x, y) + ? [button, sendButton] + : [] + } + }) + + editor.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) + + const button = document.getElementById( + 'simplewords-button' + ) as HTMLButtonElement + expect(button.style.top).toBe('108px') + expect(button.style.left).toBe('268px') + }) + test('does not avoid an invisible page button under its default position', () => { document.body.innerHTML = '' From 2d450a2ef29edd9040db6c9020eff4d62516ca64 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Mon, 1 Jun 2026 12:27:40 -0700 Subject: [PATCH 3/4] no-mistakes(document): Sync button placement docs --- .agents/skills/simple-words-design/README.md | 4 ++-- .../skills/simple-words-design/ui_kits/extension/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.agents/skills/simple-words-design/README.md b/.agents/skills/simple-words-design/README.md index aa95e1e..d8d48c6 100644 --- a/.agents/skills/simple-words-design/README.md +++ b/.agents/skills/simple-words-design/README.md @@ -180,8 +180,8 @@ The options page is fully opaque. ### Layout rules -- **Floating button** is `position: fixed`, `z-index: 2147483647` (max), starts near the active editable field's lower-right edge, and can move to avoid button-like page controls. - This is non-negotiable — it must clear every host page, including ones with their own floating UI. +- **Floating button** is `position: fixed`, `z-index: 2147483647` (max), starts near the active editable field's lower-right edge, and can move when a candidate button center would sit over a button-like page control. + Keep this placement check lightweight so typing, selection, scroll, and caret movement stay responsive on heavy host pages. Use a compact 24px `sw` glyph button for normal editors and a 20px version for short inputs. The injected button and panel are visible only while the current domain is enabled and the active editor is connected, focused, and visible, including empty editors. Hide them when the editor or any ancestor is `hidden`, `aria-hidden="true"`, or `display: none`, when the editor itself is `visibility: hidden` or `visibility: collapse`, inside a closed `dialog`, or inside closed `details` content. diff --git a/.agents/skills/simple-words-design/ui_kits/extension/README.md b/.agents/skills/simple-words-design/ui_kits/extension/README.md index 5dde15e..bddb764 100644 --- a/.agents/skills/simple-words-design/ui_kits/extension/README.md +++ b/.agents/skills/simple-words-design/ui_kits/extension/README.md @@ -6,7 +6,7 @@ Check the production extension files before treating this kit as pixel-faithful. ## Surfaces 1. **Floating button** (`FloatingButton.jsx`) - a prototype pill button with the older sparkles icon and label. - Production now uses a compact `sw` glyph button that starts near the lower-right edge of focused editable fields and can move to avoid button-like page controls, so check the extension files before treating this component as pixel-faithful. + Production now uses a compact `sw` glyph button that starts near the lower-right edge of focused editable fields and can move when a candidate button center would sit over a button-like page control, so check the extension files before treating this component as pixel-faithful. 2. **Refine panel** (`RefinePanel.jsx`) - the floating panel that shows loading, setup or provider error guidance, rewritten draft states, and Open settings/Replace/Dismiss actions. 3. **Options page** (`OptionsPage.jsx`) - the settings page prototype with provider config, enabled domains, name field, and advanced system prompt. 4. **Host page** (`HostPage.jsx`) - a faked Gmail-like compose window, just so the floating button has something to attach to in `index.html`. @@ -33,7 +33,7 @@ Preserve that visibility contract in production-facing work. ## Demo `index.html` boots a fake Gmail compose window with a draft typed in. -The prototype still positions its legacy pill below the textarea; production starts the compact `sw` button near the editor's lower-right edge and can move it to avoid button-like page controls. +The prototype still positions its legacy pill below the textarea; production starts the compact `sw` button near the editor's lower-right edge and can move it when the candidate center would sit over a button-like page control. Clicking the button opens the refine panel with a 1-second simulated "Refining..." state, then a rewritten draft. Click "Replace draft" to swap the textarea content; click "Dismiss" to close. There's also a tab switch at the top to jump to the **Options page** view. From 4b02bc3b55062ad151d7e9c16fe2933c56c14fd9 Mon Sep 17 00:00:00 2001 From: kunchenguid Date: Mon, 1 Jun 2026 12:29:01 -0700 Subject: [PATCH 4/4] no-mistakes(lint): Fix formatting for changed test --- test/content.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/content.test.ts b/test/content.test.ts index 8b376fe..39ff68d 100644 --- a/test/content.test.ts +++ b/test/content.test.ts @@ -181,9 +181,7 @@ describe('content script button visibility', () => { configurable: true, value: (x: number, y: number) => { const button = document.getElementById('simplewords-button') - return button && hitsDefaultCandidate(x, y) - ? [button, sendButton] - : [] + return button && hitsDefaultCandidate(x, y) ? [button, sendButton] : [] } })