Skip to content

refactor(motion): Phase 5 — Motion API polish - #40

Merged
jackgranatowski merged 1 commit into
mainfrom
chore/phase-5-motion-api-polish
May 21, 2026
Merged

refactor(motion): Phase 5 — Motion API polish#40
jackgranatowski merged 1 commit into
mainfrom
chore/phase-5-motion-api-polish

Conversation

@kiro-agent

@kiro-agent kiro-agent Bot commented May 21, 2026

Copy link
Copy Markdown

This pull request was created by @kiro-agent on behalf of @jackgranatowski 👻

Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent


Summary

Phase 5 of the framework perfection plan. Polishes the motion/transition API, modernizes accessibility patterns, and proves @property color interpolation works.

Changes

  • 5.1 Granular transition tokens--sf-transition-all replaces --sf-transition-base (kept as deprecated alias for 1 minor). New scoped tokens: --sf-transition-colors, --sf-transition-transform, --sf-transition-opacity, --sf-transition-shadow. Resolves F-13.
  • 5.2 .sr-only modernizedoverflow: hiddenoverflow: clip (avoids creating a scroll container; modern a11y consensus). Resolves F-18.
  • 5.3 @property color interpolation demosf-color-pulse keyframe animates --sf-color-primary-light lightness in oklch. Opt-in .sf-color-pulse class gated by prefers-reduced-motion: no-preference. Proves registered custom properties animate. Resolves F-17.
  • 5.4 --sf-current-font-weight extracted.is-current now reads var(--sf-current-font-weight, var(--sf-font-weight-bold)) so consumers can override without specificity battles. Resolves N-04.
  • 5.5 Architecture docs updated — Transition token table, color interpolation note, overflow:clip note, --sf-current-font-weight note.

Audit findings resolved

ID Issue
F-13 --sf-transition-base: all … performance footgun
F-17 @property tokens never animated in any keyframe
F-18 .sr-only uses overflow: hidden (should be clip)
N-04 .is-current hard-codes font-weight: bold

Files modified

  • core/tokens.css — transition tokens + --sf-animation-color-pulse + --sf-current-font-weight
  • core/motion.csssf-color-pulse keyframe + .sf-color-pulse class
  • core/accessibility.cssoverflow: clip
  • core/states.css.is-current tokenised
  • docs/architecture.md — documentation
  • docs/demo.html — color-pulse demo section

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced screen reader compatibility with improved overflow handling.
  • New Features

    • Introduced color pulse animation that respects user motion preferences.
    • Added new transition and animation design tokens for enhanced customization.
    • Made current state styling more customizable.
  • Documentation

    • Updated architecture documentation with token usage guidance.
    • Added animation examples to demo page.

Review Change Stack

…clip, color-pulse, is-current token

- Refactor --sf-transition-base → --sf-transition-all with deprecation alias
- Add scoped transition tokens: --sf-transition-colors, --sf-transition-transform,
  --sf-transition-opacity, --sf-transition-shadow
- Modernize .sr-only: overflow: hidden → overflow: clip (a11y consensus)
- Add @Property color interpolation demo: sf-color-pulse keyframe + .sf-color-pulse
  class proving registered custom properties animate smoothly in oklch
- Extract --sf-current-font-weight token from .is-current for overridability
- Update architecture.md with transition token table and all changes
- Add color-pulse demo section in docs/demo.html

Resolves: F-13 (transition all footgun), F-17 (@Property unused),
          F-18 (sr-only overflow:hidden), N-04 (is-current DX)

Co-authored-by: Jack Granatowski <contact@codeslash.net>
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR extends the SLASHED design system with token-driven customization, motion animations, and accessibility improvements. It introduces state and animation tokens in core/tokens.css, applies them in states and motion rules, updates screen-reader styling, and documents the complete token and animation layer architecture with an interactive demo.

Changes

Design Tokens, States, Motion, and Accessibility Enhancements

Layer / File(s) Summary
Design tokens: states, animations, and transitions
core/tokens.css
Adds --sf-current-font-weight state token, --sf-animation-color-pulse animation preset, and refactors transition shorthands with new scoped transition tokens while updating the deprecated --sf-transition-base alias.
State customization with token references
core/states.css
Updates .is-current to use configurable --sf-current-font-weight token with fallback, and expands documentation to explain token-based overriding at :root without specificity conflicts.
Color pulse animation and reduced-motion gating
core/motion.css
Adds @keyframes sf-color-pulse animating --sf-color-primary-light via oklch(from ...) interpolation, scoped to @media (prefers-reduced-motion: no-preference) to respect user motion preferences.
Screen-reader-only overflow improvement
core/accessibility.css
Changes .sr-only / .visually-hidden overflow from hidden to clip while maintaining !important priority.
Architecture documentation and interactive demo
docs/architecture.md, docs/demo.html
Documents token definitions, state customization, motion/transition system with reduced-motion gating, accessibility changes, and adds interactive demo for @property color interpolation via .sf-color-pulse.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#11: Implements initial .is-current state utilities that this PR extends with tokenized font-weight customization.
  • codeslash-dev/SLASHED#1: Scaffolds core/tokens.css, core/states.css, and core/accessibility.css as placeholders; this PR fills them with production token and rule implementations.
  • codeslash-dev/SLASHED#64: Updates accessibility and reduced-motion helpers that overlap with this PR's .sr-only and prefers-reduced-motion gating changes.

Suggested reviewers

  • jackgranatowski
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(motion): Phase 5 — Motion API polish' is partially related to the changeset, as it emphasizes the motion/transition API enhancements, but the PR includes substantial changes beyond motion (accessibility, states, tokens), making the title somewhat narrow for the full scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/phase-5-motion-api-polish

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/accessibility.css`:
- Line 120: The .sr-only (and related .visually-hidden) rule uses "overflow:
clip" which is unsupported in older browsers; update the CSS rule that contains
"overflow: clip" (the .sr-only/.visually-hidden selector) to add a legacy-safe
fallback by declaring "overflow: hidden" immediately before "overflow: clip" so
older Safari/Firefox/Chrome will use the hidden behavior instead of falling back
to visible.

In `@core/tokens.css`:
- Line 744: The custom property --sf-transition-colors is currently malformed so
only the last token (stroke) receives the duration/easing; fix it by expanding
the transition list so each property includes the duration and easing (e.g.,
"color var(--sf-duration-normal) var(--sf-ease-out), background-color
var(--sf-duration-normal) var(--sf-ease-out), border-color ..." etc.), ensuring
every property in --sf-transition-colors has its own "var(--sf-duration-normal)
var(--sf-ease-out)" suffix rather than relying on a trailing duration that only
applies to the final item.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad935462-cd40-4212-8bfa-507845e118c4

📥 Commits

Reviewing files that changed from the base of the PR and between e2b3b62 and 8a3d9ad.

📒 Files selected for processing (6)
  • core/accessibility.css
  • core/motion.css
  • core/states.css
  • core/tokens.css
  • docs/architecture.md
  • docs/demo.html

Comment thread core/accessibility.css
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
overflow: clip !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What are the browser support versions for CSS overflow: clip, especially Safari 15.4+ and Firefox/Chromium versions from 2022 onward?

💡 Result:

As of 2026-05-21, CSS overflow: clip support by browser versions (from 2022 onward) is: Safari 15.4+ - Not supported in Safari up to 15.6 (Safari 15.4 / 15.5 / 15.6 are in the unsupported range) [1]. - Supported starting Safari 16.0 (and later) [1]. Firefox (Gecko/Firefox) - Supported starting Firefox 81 (i.e., from 2022 onward: Firefox 81+ is supported) [1]. - Can I Use also lists support continuing through current versions: 81-149 supported; 150+ supported [1]. Chromium / Chrome - Supported starting Chrome 90 (so from 2022 onward: Chrome 90+ is supported) [1]. - Can I Use lists: 90-147 supported; 148+ supported [1]. Notes / scope clarifications - The above version numbers are for the CSS keyword support “overflow: clip” (and related shorthand/longhand support tables under that feature listing) [1]. - CSS Overflow Module Level 4 defines the semantics and relates overflow-clip-margin, but the question you asked is specifically about browser support versions for overflow: clip, which the Can I Use compatibility table provides [2][1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Inspect surrounding lines around the referenced location
FILE="core/accessibility.css"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE" >&2
  exit 1
fi
# Show line range with numbers around 120
sed -n '90,150p' "$FILE" | nl -ba -w2 -s':'

Repository: codeslash-dev/SLASHED

Length of output: 109


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="core/accessibility.css"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE" >&2
  exit 1
fi
# Show the exact rule context around the referenced line
sed -n '90,150p' "$FILE" | nl -ba -w2 -s':'

Repository: codeslash-dev/SLASHED

Length of output: 108


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="core/accessibility.css"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE" >&2
  exit 1
fi
# Print with line numbers using cat -n
cat -n "$FILE" | sed -n '90,150p'

Repository: codeslash-dev/SLASHED

Length of output: 2749


Add overflow: hidden fallback before overflow: clip in .sr-only

overflow: clip isn’t supported in older Safari/Firefox/Chromium (Safari <16, Firefox <81, Chrome <90), where the declaration is dropped and overflow falls back to visible, risking .sr-only/.visually-hidden content “leaking” visually. Add a legacy-safe fallback.

🔧 Proposed fix
-    overflow:    clip                !important;
+    overflow:    hidden              !important; /* fallback */
+    overflow:    clip                !important;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
overflow: clip !important;
overflow: hidden !important; /* fallback */
overflow: clip !important;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/accessibility.css` at line 120, The .sr-only (and related
.visually-hidden) rule uses "overflow: clip" which is unsupported in older
browsers; update the CSS rule that contains "overflow: clip" (the
.sr-only/.visually-hidden selector) to add a legacy-safe fallback by declaring
"overflow: hidden" immediately before "overflow: clip" so older
Safari/Firefox/Chrome will use the hidden behavior instead of falling back to
visible.

Comment thread core/tokens.css
---------------------------------------------------------- */
--sf-transition-base: all var(--sf-duration-normal) var(--sf-ease-out);
--sf-transition-all: all var(--sf-duration-normal) var(--sf-ease-out);
--sf-transition-colors: color, background-color, border-color, text-decoration-color, fill, stroke var(--sf-duration-normal) var(--sf-ease-out);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

--sf-transition-colors currently animates only stroke

The shorthand is malformed for a multi-property transition token: color, background-color, etc. will effectively use 0s, while only stroke gets the configured duration/easing.

🔧 Proposed fix
-    --sf-transition-colors:    color, background-color, border-color, text-decoration-color, fill, stroke var(--sf-duration-normal) var(--sf-ease-out);
+    --sf-transition-colors:
+      color var(--sf-duration-normal) var(--sf-ease-out),
+      background-color var(--sf-duration-normal) var(--sf-ease-out),
+      border-color var(--sf-duration-normal) var(--sf-ease-out),
+      text-decoration-color var(--sf-duration-normal) var(--sf-ease-out),
+      fill var(--sf-duration-normal) var(--sf-ease-out),
+      stroke var(--sf-duration-normal) var(--sf-ease-out);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--sf-transition-colors: color, background-color, border-color, text-decoration-color, fill, stroke var(--sf-duration-normal) var(--sf-ease-out);
--sf-transition-colors:
color var(--sf-duration-normal) var(--sf-ease-out),
background-color var(--sf-duration-normal) var(--sf-ease-out),
border-color var(--sf-duration-normal) var(--sf-ease-out),
text-decoration-color var(--sf-duration-normal) var(--sf-ease-out),
fill var(--sf-duration-normal) var(--sf-ease-out),
stroke var(--sf-duration-normal) var(--sf-ease-out);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/tokens.css` at line 744, The custom property --sf-transition-colors is
currently malformed so only the last token (stroke) receives the
duration/easing; fix it by expanding the transition list so each property
includes the duration and easing (e.g., "color var(--sf-duration-normal)
var(--sf-ease-out), background-color var(--sf-duration-normal)
var(--sf-ease-out), border-color ..." etc.), ensuring every property in
--sf-transition-colors has its own "var(--sf-duration-normal)
var(--sf-ease-out)" suffix rather than relying on a trailing duration that only
applies to the final item.

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