fix: contain focused Related Stories cards
This commit is contained in:
2 files changed
+18
-2
No files matched your search
@@ -123,9 +123,12 @@ html[data-theme="light"] .chrnx-related-posts {
|
||||
|
||||
@media (hover: hover) {
|
||||
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-card:hover {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-carousel .chrnx-related-card:hover:not(:focus-within) {
|
||||
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--chrnx-green) 62%, transparent);
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +150,12 @@ html[data-theme="light"] .chrnx-related-posts {
|
||||
|
||||
@media (hover: hover) {
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card:hover {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.chrnx-related-posts.is-layout-adaptive .chrnx-related-card:hover:not(:focus-within) {
|
||||
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--chrnx-green) 62%, transparent);
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,9 +467,13 @@ for ( const theme of [ 'light', 'dark' ] ) {
|
||||
await expect( link ).toBeFocused();
|
||||
await link.hover();
|
||||
await expect( link ).toBeFocused();
|
||||
await page.waitForTimeout( 220 );
|
||||
|
||||
const appearance = await link.evaluate( ( focusedLink ) => {
|
||||
const card = focusedLink.closest( '.chrnx-related-card' );
|
||||
const trackElement = card.parentElement;
|
||||
const cardRect = card.getBoundingClientRect();
|
||||
const trackRect = trackElement.getBoundingClientRect();
|
||||
const style = window.getComputedStyle( card );
|
||||
const token = style.getPropertyValue( '--chrnx-related-focus-ring' ).trim();
|
||||
const probe = document.createElement( 'span' );
|
||||
@@ -485,9 +489,15 @@ for ( const theme of [ 'light', 'dark' ] ) {
|
||||
ring: colors?.at( -1 ) || null,
|
||||
shadow: style.boxShadow,
|
||||
token: normalizedToken,
|
||||
transform: style.transform,
|
||||
topDelta: cardRect.top - trackRect.top,
|
||||
bottomDelta: trackRect.bottom - cardRect.bottom,
|
||||
};
|
||||
} );
|
||||
|
||||
expect( appearance.transform ).toBe( 'none' );
|
||||
expect( appearance.topDelta ).toBeGreaterThanOrEqual( -1 );
|
||||
expect( appearance.bottomDelta ).toBeGreaterThanOrEqual( -1 );
|
||||
expect( appearance.shadow ).toContain( 'inset' );
|
||||
expect( appearance.shadow ).toMatch( /0px 0px 0px 3px/ );
|
||||
expect( appearance.ring ).toBeTruthy();
|
||||
|
||||
Reference in new issue
Block a user