Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hide intra-'Item' dividers on ':hover' and ':focus' #1259

Merged
merged 3 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-toes-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/components": patch
---

Hide intra-'Item' dividers on ':hover' and ':focus'
24 changes: 18 additions & 6 deletions src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,25 @@ const StyledItem = styled.div<
border: 0 solid ${get('colors.selectMenu.borderSecondary')};
border-top-width: ${({showDivider}) => (showDivider ? `1px` : '0')};
}
}

// Override if current or previous item is active descendant
&.${itemActiveDescendantClass}, .${itemActiveDescendantClass} + & {
${StyledItemContent}::before {
border-color: transparent;
}
}
// Item dividers should not be visible:
// - above Hovered
&:hover ${StyledItemContent}::before,
// - below Hovered
// '*' instead of '&' because '&' maps to separate class names depending on 'variant'
:hover + * ${StyledItemContent}::before,
// - above Focused
&:focus ${StyledItemContent}::before,
// - below Focused
// '*' instead of '&' because '&' maps to separate class names depending on 'variant'
:focus + * ${StyledItemContent}::before,
// - above Active Descendent
&.${itemActiveDescendantClass} ${StyledItemContent}::before,
// - below Active Descendent
.${itemActiveDescendantClass} + & ${StyledItemContent}::before {
// '!important' because all the ':not's above give higher specificity
border-color: transparent !important;
smockle marked this conversation as resolved.
Show resolved Hide resolved
}

// Focused OR Active Descendant
Expand Down