Skip to content

Enhance compatibility for dark mode theming in interactive-surface-css#13

Merged
Foscat merged 3 commits into
mainfrom
uiStyleKit
Jun 1, 2026
Merged

Enhance compatibility for dark mode theming in interactive-surface-css#13
Foscat merged 3 commits into
mainfrom
uiStyleKit

Conversation

@Foscat

@Foscat Foscat commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

This PR applies compatibility revisions so interactive-surface-css integrates cleanly with ui-style-kit-css theme containers and mode-based theming.

Scope

  • bug fix
  • feature
  • docs
  • tests
  • release/chore

Validation

List commands you ran and results.

npm run lint:css
npm test
npm run pack:dry

API and Behavior Impact

  • no public API changes
  • class API changed
  • token contract changed
  • accessibility behavior changed
  • motion behavior changed
  • browser behavior changed

Documentation

  • README updated (if needed)
  • wiki updated (if needed)
  • CHANGELOG updated (if needed)

Notes

  • Added integration guidance in README for ui-style-kit-css usage patterns, including when to import the bridge from ui-style-kit-css.
  • Updated Unreleased changelog notes to document the integration and selector compatibility improvements, including removal of forced-color-adjust.
  • Expanded icon-role dark selector prefixes in interactive-surface.css to include [data-mode="dark"] and [data-mode="contrast"].
  • Removed an unsupported forced-color-adjust declaration in forced-colors styles to clear compatibility warnings.
  • Added Playwright regression tests covering data-mode="dark" and data-mode="contrast" icon-role color behavior.
  • Fixed the icon-role color test to explicitly set colorScheme: "light" emulation before asserting baseline colors, preventing flakiness on dark-scheme CI runners.

This PR applies compatibility revisions so interactive-surface-css integrates cleanly with ui-style-kit-css theme containers and mode-based theming.

## Why
Integration usage exposed a gap where dark icon-role selectors responded to data-theme but not data-mode containers used by ui-style-kit-css. This could cause inconsistent icon-role colors in dark and contrast mode contexts.

## What Changed
- Added integration guidance in README for ui-style-kit-css usage patterns, including when to import the bridge from ui-style-kit-css.
- Updated Unreleased changelog notes to document the integration and selector compatibility improvements.
- Expanded icon-role dark selector prefixes in interactive-surface.css to include:
  - [data-mode="dark"]
  - [data-mode="contrast"]
- Removed an unsupported forced-color-adjust declaration in forced-colors styles to clear compatibility warnings.

## Validation
- Ran npm run lint:css
- Performed visual sanity check in index.html demo
- Verified all icon-role dark selector entries now include data-mode dark and data-mode contrast targeting

## Type of Change
- [ ] Fix
- [x] Feature
- [ ] Refactor
- [x] Docs
- [x] Chore

## Risk
Low. Changes are scoped to documentation and selector matching expansion for dark/contrast mode containers, with no API surface changes.

## Rollback
Revert this PR to restore previous dark selector behavior and docs wording.

## Checklist
- [x] Public compatibility behavior documented
- [x] No unrelated file churn
- [x] Compatibility warnings addressed
@Foscat Foscat self-assigned this May 31, 2026
@Foscat Foscat added the documentation Improvements or additions to documentation label May 31, 2026
Copilot AI review requested due to automatic review settings May 31, 2026 23:17
@Foscat Foscat added the enhancement New feature or request label May 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves dark/contrast mode theming compatibility for interactive-surface-css when used inside ui-style-kit-css theme containers by expanding icon-role dark selectors to recognize data-mode containers, and updates docs/changelog accordingly.

Changes:

  • Documented recommended integration patterns for ui-style-kit-css usage in README.md.
  • Expanded icon-role dark-mode selector prefixes in interactive-surface.css to include [data-mode="dark"] and [data-mode="contrast"].
  • Removed forced-color-adjust from forced-colors styles to avoid compatibility warnings, and updated CHANGELOG.md Unreleased notes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Adds integration guidance for using this package alongside ui-style-kit-css (including bridge usage).
interactive-surface.css Broadens dark/contrast container matching for icon-role colors; removes forced-color-adjust in forced-colors styles.
CHANGELOG.md Updates Unreleased notes to reflect the compatibility-focused docs and selector changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md
Comment on lines +13 to +15
### Changed

- Expanded dark theme icon-role selectors to also match `data-mode="dark"` and `data-mode="contrast"` containers for broader cross-library theming compatibility.
Comment thread interactive-surface.css
Comment on lines +269 to 288
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark) .interactive-surface.icon-only .light-icon,
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark)
.interactive-surface.icon-only
[data-icon-role="light"] {
color: var(--interactive-surface-light-icon-color-dark, var(--icon-light-dark, rgb(255 255 255)));
}

:where([data-theme="dark"], .theme-dark, .dark-mode, .dark) .interactive-surface.icon-only .dark-icon,
:where([data-theme="dark"], .theme-dark, .dark-mode, .dark)
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark) .interactive-surface.icon-only .dark-icon,
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark)
.interactive-surface.icon-only
[data-icon-role="dark"] {
color: var(--interactive-surface-dark-icon-color-dark, var(--icon-dark-dark, rgb(30 58 138)));
}

:where([data-theme="dark"], .theme-dark, .dark-mode, .dark)
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark)
.interactive-surface.icon-only
.accessibility-icon,
:where([data-theme="dark"], .theme-dark, .dark-mode, .dark)
:where([data-theme="dark"], [data-mode="dark"], [data-mode="contrast"], .theme-dark, .dark-mode, .dark)
.interactive-surface.icon-only
[data-icon-role="accessibility"] {

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +134 to +138
test("data-mode dark and contrast containers apply dark icon-role colors without changing baseline colors", async ({
page
}) => {
const getColor = async (selector: string) =>
page.locator(selector).evaluate((el) => window.getComputedStyle(el).color);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 70a1d3f. Added await page.emulateMedia({ colorScheme: "light" }) + await page.setContent(html) at the start of the test, following the same pattern as the existing reduced-motion test. Baseline color assertions are now deterministic regardless of the host OS color scheme.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@Foscat Foscat enabled auto-merge (squash) June 1, 2026 05:57
@Foscat Foscat requested a review from Copilot June 1, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@Foscat Foscat disabled auto-merge June 1, 2026 06:01
@Foscat Foscat merged commit 6a16510 into main Jun 1, 2026
6 checks passed
@Foscat Foscat deleted the uiStyleKit branch June 1, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants