Skip to content

fix: make data-bone-animate work from the element that carries it (BON-17) - #45

Merged
hunterbecton merged 1 commit into
mainfrom
hunter/bon-17-data-bone-animate-has-no-effect-on-the-element-that-carries
Aug 27, 2026
Merged

fix: make data-bone-animate work from the element that carries it (BON-17)#45
hunterbecton merged 1 commit into
mainfrom
hunter/bon-17-data-bone-animate-has-no-effect-on-the-element-that-carries

Conversation

@hunterbecton

@hunterbecton hunterbecton commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Fixes BON-17.

data-bone-animate only worked from a wrapper. On the marked bone itself, or on the aria-busy element of an auto region, it was a silent no-op: the shimmer kept running, and "shimmer" on a marked bone never started.

Root cause

The animation variants live in @scope blocks. A scoped selector gets an implicit :scope prefix with a descendant combinator, so its subject and ancestor compounds only match strict descendants of the scope root — never the root itself. Verified the semantics in Chromium with a throwaway browser test before changing the shipped CSS.

Fix

  • bones.css: the animated subjects in the three scope blocks now carry :is(:scope, :scope *), so a bone that carries the attribute matches as the scope root.
  • auto.css: the 21 leading [aria-busy="true"] compounds inside the scope blocks get the same treatment, so the attribute works on the aria-busy element itself. The unscoped default and fallback rules are untouched.
  • Donut limits are unaffected: an inner data-bone-animate subtree still escapes the outer scope, so nested overrides keep working.

One deliberate limit: for auto regions the attribute works on the aria-busy element or above. An unmarked leaf inside the region still cannot carry it, because its aria-busy ancestor sits above the scope root. The docs state this.

Tests

New tests/browser/animation-scope.test.ts with 9 browser tests. The 6 on-self cases failed before the fix; 3 more pin wrapper behavior and nested overrides. Full suite: 205/205, vp check clean.

The committed Linux visual baselines still pass locally: the bare-card fixture changes from a frozen gradient to solid base, which stays under the 1% pixelmatch threshold. If the visual job disagrees, the baselines need the usual regen pass.

Docs

Both READMEs, styling.mdx, and examples.mdx no longer claim the wrapper is required, and the stale comment in adaptive-colors.test.ts is gone. Patch changeset included.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • data-bone-animate now works when applied directly to a bone or an aria-busy element, as well as to ancestor elements.
    • Animation settings correctly apply to both the selected element and its descendants.
    • Inner animation settings continue to take precedence over outer wrappers.
  • Documentation

    • Updated guides and examples to reflect the expanded animation behavior.
  • Tests

    • Added coverage for direct, inherited, and opt-out animation settings.

…N-17)

The animation variants live in @scope blocks, and a scoped selector's
implicit :scope prefix matches strict descendants only — so the attribute
was a silent no-op on the marked bone itself and on the aria-busy element
of an auto region. The scoped selectors now include the scope root via
:is(:scope, :scope *), with browser regression tests for both stylesheets
and updated docs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b56bb8c9-4fa3-435b-b35e-3d08f9e57b6c

📥 Commits

Reviewing files that changed from the base of the PR and between efdddb5 and 1ae2f31.

📒 Files selected for processing (9)
  • .changeset/animate-on-carrier.md
  • README.md
  • apps/docs/content/docs/examples.mdx
  • apps/docs/content/docs/styling.mdx
  • packages/bones/README.md
  • packages/bones/src/css/auto.css
  • packages/bones/src/css/bones.css
  • packages/bones/tests/browser/adaptive-colors.test.ts
  • packages/bones/tests/browser/animation-scope.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

data-bone-animate now applies to its own bone or aria-busy element. Scoped selectors include the scope root. Browser tests and documentation cover direct application, wrappers, opt-out behavior, and precedence.

Changes

Animation scope behavior

Layer / File(s) Summary
Include animation scope roots
packages/bones/src/css/bones.css, packages/bones/src/css/auto.css
Animation selectors now match the scope root and its descendants for marked bones and automatic regions across shimmer, pulse, none, reduced-motion, and forced-colors rules.
Validate and document direct application
packages/bones/tests/browser/animation-scope.test.ts, packages/bones/tests/browser/adaptive-colors.test.ts, README.md, apps/docs/content/docs/*.mdx, packages/bones/README.md, .changeset/animate-on-carrier.md
Browser tests cover direct application, wrappers, opt-out behavior, and inner-value precedence. Documentation and the changeset describe the updated behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 1ae2f

This localized CSS fix enables animations on the element carrying the attribute while preserving wrapper and nested behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (7 skipped: 7 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main fix: making data-bone-animate work on the element that carries it.
Description check ✅ Passed The description explains the issue, root cause, implementation, tests, documentation updates, and changeset. It provides the required What/Why and Testing information, although it uses equivalent head…
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.
Full details: Description check

Explanation

The description explains the issue, root cause, implementation, tests, documentation updates, and changeset. It provides the required What/Why and Testing information, although it uses equivalent headings instead of the exact template headings.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (7 skipped: 7 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hunter/bon-17-data-bone-animate-has-no-effect-on-the-element-that-carries

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

@hunterbecton
hunterbecton merged commit 14ff496 into main Aug 27, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 27, 2026
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.

1 participant