Skip to content

Commit

Permalink
add :focus-within to all cards (#3284)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Benson <[email protected]>
  • Loading branch information
2 people authored and chrisdholt committed Jun 16, 2020
1 parent c57c064 commit 0333bee
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const CardSectionStyles = css`
filter: saturate(0);
}
:host ::slotted(site-feature-card:hover) {
:host ::slotted(site-feature-card:hover),
:host ::slotted(site-feature-card:focus-within) {
cursor: pointer;
color: currentColor;
background-color: var(--neutral-fill-hover);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const ContentPlacementContainerStyles = css`
margin-bottom: calc(var(--design-unit) * 2px);
}
:host([section="feature"]) site-feature-card:hover :first-child::before {
:host([section="feature"]) site-feature-card:hover :first-child::before,
:host([section="feature"]) site-feature-card:focus-within :first-child::before {
color: var(--accent-foreground-rest);
}
Expand All @@ -54,23 +55,29 @@ export const ContentPlacementContainerStyles = css`
/* This creates the color, background, and elevation changes on hover */
:host([section="feature"]:hover),
:host([section="feature"]:focus-within),
:host([section="community"]:hover) site-content-placement,
:host([section="community"]:hover) site-content-placement ::part(content) {
:host([section="community"]:focus-within) site-content-placement,
:host([section="community"]:hover) site-content-placement ::part(content),
:host([section="community"]:focus-within) site-content-placement ::part(content) {
color: var(--neutral-foreground-hint);
}
:host([section="feature"]:hover) site-feature-card {
:host([section="feature"]:hover) site-feature-card,
:host([section="feature"]:focus-within) site-feature-card {
filter: saturate(0);
}
:host([section="feature"]) site-feature-card:hover {
:host([section="feature"]) site-feature-card:hover,
:host([section="feature"]) site-feature-card:focus-within {
color: var(--neutral-foreground-rest);
background: var(--neutral-fill-focus);
cursor: pointer;
filter: saturate(1);
}
:host([section="community"]) site-content-placement:hover {
:host([section="community"]) site-content-placement:hover,
:host([section="community"]) site-content-placement:focus-within {
--elevation: 4;
cursor: pointer;
background: var(--neutral-fill-focus);
Expand All @@ -79,7 +86,8 @@ export const ContentPlacementContainerStyles = css`
${elevation}
}
:host([section="community"]) site-content-placement:hover ::part(content) {
:host([section="community"]) site-content-placement:hover ::part(content),
:host([section="community"]) site-content-placement:focus-within ::part(content) {
color: var(--accent-foreground-rest);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export const ContentPlacementStyles = css`
margin-top: calc(var(--design-unit) * 2px);
}
fast-card:hover .contentPlacement_icon {
fast-card:hover .contentPlacement_icon,
fast-card:focus-within .contentPlacement_icon {
visibility: visible;
}
Expand Down

0 comments on commit 0333bee

Please sign in to comment.