Skip to content

fix: scope preview overrides to our preview, fix dark-mode contrast - #249

Merged
StephenTangCook merged 1 commit into
mainfrom
dgomes/eng-6391-preview-dark-contrast
Oct 19, 2026
Merged

StephenTangCook merged 1 commit into
mainfrom
dgomes/eng-6391-preview-dark-contrast

Conversation

@programad

@programad programad commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

Scopes every preview override to #slack_blocks_to_jsx:where(.styles_enabled), our own preview root, and fixes two dark-preview contrast failures.

Why

  • Leak: the overrides were scoped to a bare #slack_blocks_to_jsx. Hosts also render slack-blocks-to-jsx unstyled under that id (Studio's message bodies), and this stylesheet stays loaded for the SPA session after one Message Blaster visit. So block-kitchen's inline-code red and link underline repainted those bodies too: inline code read 3.4:1 in Studio dark. :where() keeps every rule's specificity unchanged.
  • Dark preview mentions: upstream's rgb(29 155 209) on its own 20% tint reads 4.01:1 on the #1a1d21 canvas. Lightened to #4aafda (same hue), 5.08:1.
  • Dark preview inline code: the #c4144b fix applied in both themes and read 2.63:1 on the dark canvas. It's light-only now, so upstream's dark code colors apply (6.3–10.3:1). It also covers rich-text inline code (.slack_inline_code), which still read 4.31:1 in light.

Context: ENG-6391, TightknitAI/tightknit-app#7519 (merged). Land TightknitAI/tightknit-app#7563 before bumping this package in tightknit-app: without it, the library's own inline-code red shows through in Studio once this scoping lands.

Test plan

  • pnpm typecheck
  • pnpm lint
  • pnpm test: 61/62 files, 731/735 tests pass, Storybook project included. The 4 failures are main's new rich-text-input tests, which need slack-block-kit-validator@0.1.20. My machine's package-age guard blocks that version for now, so it ran on 0.1.19. The same reason kept the local pre-push hook from passing; CI installs 0.1.20.
  • New test/preview-theme-contrast.test.tsx, on the built stylesheet in Chromium. It checks AA (4.5:1) for mentions, inline code and links in both preview themes. It also checks that an unstyled host root sharing the id computes the same as with upstream's stylesheet alone. All 4 cases fail on main and pass here.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

- Scope every #slack_blocks_to_jsx override to :where(.styles_enabled),
  the root our previews render. Hosts render the library unstyled under
  the same id, and this stylesheet stays loaded for the SPA session, so
  the overrides were repainting the host's own message bodies.
- Dark preview: lighten user/channel/user-group mentions to 5.08:1
  (upstream reads 4.01:1 on its own tint).
- Inline code red is light-only: it read 2.63:1 on the dark preview.
  Also covers rich-text inline code, which still read 4.31:1 in light.

Refs ENG-6391

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

✅ Deployed 1562786 · Branch preview · Commit preview · Build logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
block-kitchen 1562786 Commit Preview URL

Branch Preview URL
Oct 17 2026, 06:10 PM

@StephenTangCook
StephenTangCook merged commit 40c9fca into main Oct 19, 2026
13 checks passed
@StephenTangCook
StephenTangCook deleted the dgomes/eng-6391-preview-dark-contrast branch October 19, 2026 18:32
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.

2 participants