Skip to content

fix(tile-manager): add the view transition rules - #2648

Open
adrianptrv wants to merge 3 commits into
masterfrom
apetrov/tile-manager-view-transitions
Open

adrianptrv wants to merge 3 commits into
masterfrom
apetrov/tile-manager-view-transitions

Conversation

@adrianptrv

Copy link
Copy Markdown
Contributor

What changed

  • The rules move to src/components/tile-manager/themes/view-transitions.base.scss, unchanged.
  • When a tile manager is added to the page, it adds these rules to the page itself (document.adoptedStyleSheets), so they no longer depend on the theme.
  • If the app later removes them, for example by replacing all its style sheets in a theme switch, the next tile transition adds them back before it starts.
  • The theme files no longer contain them.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Related Issues

Closes #2608

Testing

Steps for testing:

Turn off "Reduce motion" in the OS first, or the transitions are skipped.

  1. Run npm start and open a Tile Manager story. The theme no longer contains the rules, so this is the same situation as an app with a custom Sass theme.
  2. Optional: in DevTools → More tools → Animations, set the speed to 10% to slow the transitions down.
  3. Maximize a tile: the text stays sharp and the new content fades in.
  4. Resize a tile from its corner: it stays above the tiles that move.
  5. Drag a tile by its header onto another: the ghost stays on the pointer.
  6. In the DevTools console, this returns true as soon as the story loads, before any transition:
    document.adoptedStyleSheets.some(s => [...s.cssRules].some(r => r.cssText.includes('igc-tile-resize')))
  7. Theme switch: in the console, run document.adoptedStyleSheets = [], then maximize a tile. The transition still looks right, and the check from step 6 returns true again.

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed
  • I have added a CHANGELOG.md entry under [Unreleased]

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.

🟡 Changes recommended

The transition helper still uses the global document instead of document-specific stylesheets, and the reconnect test leaves the manager and its observers outside fixture cleanup.

2 open issues
What changed in this PR

This PR addresses #2608 by making Tile Manager’s view-transition styling independent of global themes, so applications using custom Sass themes receive the same animations.

Changes:

  • Moves the existing transition rules into a component-owned stylesheet.
  • Adopts the stylesheet on connection and restores it before transitions if the application removes it.
  • Updates animation tests, the component specification, and the changelog.
File Description
src/​styles/​themes/​base/​_view-transitions.scss Removes the theme-owned transition mixin.
src/​styles/​themes/​base/​_theme.scss Removes the transition mixin import and inclusion.
src/​components/​tile-manager/​transitions.ts Adds stylesheet adoption before tile transitions.
src/​components/​tile-manager/​tile-manager.ts Adopts transition styles when the manager connects.
src/​components/​tile-manager/​tile-manager.spec.ts Tests adoption, restoration, overrides, and theme-independent fading.
src/​components/​tile-manager/​tile-dnd.spec.ts Tests drag-ghost animation without loading a theme.
src/​components/​tile-manager/​themes/​view-transitions.base.scss Houses the unchanged transition rules.
src/​components/​tile-manager/​spec.md Documents stylesheet ownership and related test scenarios.
CHANGELOG.md Records the custom-theme transition fix.

Review effort: Balanced

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tile manager: its view transition rules are in the theme files, so apps with their own theme don't get them

3 participants