Skip to content

feat(extension): add Slack to enabled domains by default - #40

Open
TheGlitching wants to merge 1 commit into
kunchenguid:mainfrom
TheGlitching:feat/slack-default-domain
Open

TheGlitching wants to merge 1 commit into
kunchenguid:mainfrom
TheGlitching:feat/slack-default-domain

Conversation

@TheGlitching

Copy link
Copy Markdown

Intent

Simple Words already works on Slack's web client — it just is not switched on there. Slack's message composer is a Quill editor (div.ql-editor[contenteditable="true"][data-qa="texty_input"]), which the existing generic findEditableRoot in src/content.ts already matches, and replaceWithNativeEditing already replaces its contents correctly. The only missing piece was app.slack.com in DEFAULT_ENABLED_DOMAINS.

Slack is where a lot of the "rough reply you should not send as-is" moments happen, so enabling it by default rather than leaving it to manual configuration seemed worth proposing.

What Changed

  • Added app.slack.com to DEFAULT_ENABLED_DOMAINS in src/settings.ts, and updated the README defaults table to match.
  • Added a settings regression test covering the Slack client host, and asserting that slack.com (the marketing site) still does not match.
  • Added a content regression test covering a Quill-shaped composer: the floating button appears for .ql-editor, and stays hidden for Quill's off-screen .ql-clipboard node.

No new selectors, no changes to editor-detection or draft-replacement logic, no locale changes.

Risk Assessment

✅ Low: The functional change is one entry in a default array. The existing generic editor detection and replacement paths are unmodified, and the two new tests lock in the behaviour the change depends on rather than introducing new behaviour.

Testing

  • Summary: Verified at unit level, then end-to-end in real Chromium with the built extension loaded, then against the live Slack web client.
  • pnpm run format:check
  • pnpm run lint
  • pnpm test (118 tests)
  • pnpm run build

Unit level

  • isSimpleWordsEnabledForUrl returns true for https://app.slack.com/client/T…/C… and still false for https://slack.com/, so the change does not widen matching beyond the client host.
  • Focusing .ql-editor shows the floating button positioned inside the composer box, while focusing Quill's off-screen .ql-clipboard node (measured at x ≈ -99363, 1x1) leaves the button hidden. That decoy is already excluded by the existing isElementInsideViewport guard — the test locks that behaviour in rather than adding a special case.

End to end, real Chromium with the built extension loaded

A throwaway harness (not part of this diff) launched Chromium with --load-extension=extension/ and --host-resolver-rules=MAP app.slack.com 127.0.0.1:<port>, serving a Slack-shaped page (message list plus a Quill composer with the real class and data-qa attributes) under the genuine app.slack.com hostname, with a local Ollama model as the provider. enabledDomains was deliberately left unset so the built-in defaults were what was under test.

  • With this change: the floating button appeared on focus, refining produced a rewritten draft, and "Replace draft" put the rewritten text into the Quill composer.
  • With app.slack.com removed from the defaults and nothing else altered: the button did not appear at all.

Live Slack, measured before this change

  • replaceWithNativeEditing replayed against the live composer returned true and produced correct multi-line output across two Quill block elements.
  • Slack's own model accepted it, not just the DOM: after replacement, a full page reload restored the text as a Slack draft and the conversation list showed a draft marker.
  • buttonPositionNearEditor placed the button inside the composer's right edge, with document.elementFromPoint hitting a text node — no collision with the send, emoji, or formatting controls.
  • A Slack DM yielded roughly 2,900 visible characters of page context against the 30,000-character cap, so the model receives the conversation.

Not fully green: pnpm run test:e2e

4 of the 5 Playwright tests fail on my machine, and they fail identically on the unmodified base commit. My Chrome runs in French, so the extension renders its French locale while the e2e assertions expect English strings ("Replace draft" vs "Remplacer le brouillon"). e2e/button-overlap.spec.ts passes. This looks like an environment/locale assumption in the existing suite rather than anything introduced here, so I left it alone to keep this PR to a single concern — happy to open a separate issue if that would be useful.

Known limitation

Slack's new-DM recipient picker (div.c-multi_select_input__input) is also contenteditable, so the floating button appears there too, where rewriting is meaningless. This PR deliberately does not handle it: any fix would have to be a generic "skip recipient/token inputs" rule, and that risks regressing the mail clients this extension already supports. It seemed better to keep this change to the one line it needs and treat the recipient picker as a separate question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant