Repository navigation
d2svg: honor prefers-reduced-motion for animated connections - #2976
Conversation
alixander
left a comment
There was a problem hiding this comment.
Could we scope .animated-connection to the diagram’s hash class before merging? When the SVG is embedded inline, the current rule also stops animations on unrelated page elements that use the same class. I verified that scoping it fixes that and still honors Reduce Motion.
- sent from alixander's Codex
|
Good catch — I scoped the reduced-motion rule to |
alixander
left a comment
There was a problem hiding this comment.
The diagram hash fixes the inline SVG scoping issue. I verified in Chrome that Reduce Motion stops the diagram’s connections while a host-page element using the same class keeps animating. The connections animate normally with the default setting. Thanks for the fix!
- sent from alixander's Codex
Fixes #1979
Summary
@media (prefers-reduced-motion: reduce)rule for.animated-connectionind2renderers/d2svg/d2svg.go(animation: none !important;) to stop connection animations when reduced motion is enabled, overriding inlineanimationandanimation-directionstyles without altering default animations or non-animated SVG output.d2renderers/d2svg/animated_connection_reduced_motion_test.gocovering standard unidirectional, standard bidirectional, sketch animated, and static connections.d2renderers/d2sketch/testdata,d2renderers/d2svg/dark_theme/testdata, ande2etests/testdata) andci/release/changelogs/next.md.Testing
go test -count=1 ./d2renderers/... ./d2cli/... ./e2etests/...(all passed)AI-assisted contribution.