fix(ui-sidebar-right): keep the panel still on open for reduced motion

The reduced-motion rule only matched the closed selectors, so the more specific open rule kept its slide. Match the open selectors too.
This commit is contained in:
Turtle committed 2026-10-22 00:10:29 +08:00
1 parent f2a52f6f3c
commit a55c9c5ddf
2 files changed
+11 -1

No files matched your search

@@ -119,7 +119,10 @@
@media (prefers-reduced-motion: reduce) {
.panel :global([data-dockkit-host='dock']),
.panel :global([data-dockkit-empty]),
.panel :global([data-dockkit-divider]) {
.panel :global([data-dockkit-divider]),
.panel[data-sidebar-right-open] :global([data-dockkit-host='dock']),
.panel[data-sidebar-right-open] :global([data-dockkit-empty]),
.panel[data-sidebar-right-open] :global([data-dockkit-divider]) {
transition: none;
}
}
@@ -37,6 +37,13 @@ describe('SidebarRight.module.css', () => {
.toBe('none')
})
it('removes the open and close slides for reduced motion', () => {
const reduce = css.slice(css.indexOf('@media (prefers-reduced-motion: reduce)'))
const motion = rules[ruleIndex([...items.map(item => `.panel ${item}`), ...items.map(item => `.panel[data-sidebar-right-open] ${item}`)])]
expect(reduce).toContain(motion!.selectors[0])
expect(motion?.declarations.get('transition')).toBe('none')
})
it('overrides the open slide with the closed style while an item settles', () => {
const open = ruleIndex(items.map(item => `.panel[data-sidebar-right-open] ${item}`))
const settling = ruleIndex(['.panel[data-sidebar-right-open] :global([data-sidebar-right-settling])'])