Repository navigation
feat(extension): add Slack to enabled domains by default - #40
Open
TheGlitching wants to merge 1 commit into
Open
TheGlitching wants to merge 1 commit into
TheGlitching wants to merge 1 commit into
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
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 genericfindEditableRootinsrc/content.tsalready matches, andreplaceWithNativeEditingalready replaces its contents correctly. The only missing piece wasapp.slack.cominDEFAULT_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
app.slack.comtoDEFAULT_ENABLED_DOMAINSinsrc/settings.ts, and updated the README defaults table to match.settingsregression test covering the Slack client host, and asserting thatslack.com(the marketing site) still does not match.contentregression test covering a Quill-shaped composer: the floating button appears for.ql-editor, and stays hidden for Quill's off-screen.ql-clipboardnode.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
pnpm run format:checkpnpm run lintpnpm test(118 tests)pnpm run buildUnit level
isSimpleWordsEnabledForUrlreturnstrueforhttps://app.slack.com/client/T…/C…and stillfalseforhttps://slack.com/, so the change does not widen matching beyond the client host..ql-editorshows the floating button positioned inside the composer box, while focusing Quill's off-screen.ql-clipboardnode (measured at x ≈ -99363, 1x1) leaves the button hidden. That decoy is already excluded by the existingisElementInsideViewportguard — 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 anddata-qaattributes) under the genuineapp.slack.comhostname, with a local Ollama model as the provider.enabledDomainswas deliberately left unset so the built-in defaults were what was under test.app.slack.comremoved from the defaults and nothing else altered: the button did not appear at all.Live Slack, measured before this change
replaceWithNativeEditingreplayed against the live composer returnedtrueand produced correct multi-line output across two Quill block elements.buttonPositionNearEditorplaced the button inside the composer's right edge, withdocument.elementFromPointhitting a text node — no collision with the send, emoji, or formatting controls.Not fully green:
pnpm run test:e2e4 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.tspasses. 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 alsocontenteditable, 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.