Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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/yellow-pillows-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Extends Navigation Item highlight to full width to cover secondary actions
25 changes: 16 additions & 9 deletions polaris-react/src/components/Navigation/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,11 @@ $disabled-fade: 0.6;
.Item {
@include nav-item-attributes;
position: relative;

margin-inline-start: var(--p-space-2);

&:last-child {
margin-inline-end: var(--p-space-2);
}
}

.Item-selected {
font-weight: var(--p-font-weight-semibold);
color: var(--p-text-primary);
background-color: var(--p-background-selected);
outline: var(--p-border-width-1) solid transparent;

&::before {
Expand Down Expand Up @@ -203,9 +196,24 @@ $disabled-fade: 0.6;
}

.ItemWrapper {
width: 100%;
padding: 0 var(--p-space-2);
}

.ItemInnerWrapper {
display: flex;
flex-wrap: nowrap;
width: 100%;

&:hover {
background: var(--p-background-hovered);
color: var(--p-text);
text-decoration: none;
}
}

.ItemInnerWrapper-Selected {
background-color: var(--p-background-selected);
}

.Text {
Expand Down Expand Up @@ -238,8 +246,7 @@ $disabled-fade: 0.6;
display: flex;
align-items: center;
height: nav(mobile-height);
padding: var(--p-space-1) var(--p-space-4);
margin-right: var(--p-space-1);
padding: var(--p-space-1) var(--p-space-3) var(--p-space-1) var(--p-space-4);
border-radius: var(--p-border-radius-1);

@media #{$p-breakpoints-md-up} {
Expand Down
6 changes: 0 additions & 6 deletions polaris-react/src/components/Navigation/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ $nav-animation-variables: (
text-decoration: none;
text-align: left;

&:hover {
background: var(--p-background-hovered);
color: var(--p-text);
text-decoration: none;
}

@include focus-ring;

&.keyFocused {
Expand Down
41 changes: 24 additions & 17 deletions polaris-react/src/components/Navigation/components/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,25 +315,32 @@ export function Item({
return (
<li className={className}>
<div className={styles.ItemWrapper}>
<UnstyledLink
url={url}
className={itemClassName}
external={external}
tabIndex={tabIndex}
aria-disabled={disabled}
aria-label={accessibilityLabel}
onClick={getClickHandler(onClick)}
onKeyUp={handleKeyUp}
onBlur={handleBlur}
{...normalizeAriaAttributes(
secondaryNavigationId,
subNavigationItems.length > 0,
showExpanded,
<div
className={classNames(
styles.ItemInnerWrapper,
selected && canBeActive && styles['ItemInnerWrapper-Selected'],
)}
>
{itemContentMarkup}
</UnstyledLink>
{secondaryActionMarkup}
<UnstyledLink
url={url}
className={itemClassName}
external={external}
tabIndex={tabIndex}
aria-disabled={disabled}
aria-label={accessibilityLabel}
onClick={getClickHandler(onClick)}
onKeyUp={handleKeyUp}
onBlur={handleBlur}
{...normalizeAriaAttributes(
secondaryNavigationId,
subNavigationItems.length > 0,
showExpanded,
)}
>
{itemContentMarkup}
</UnstyledLink>
{secondaryActionMarkup}
</div>
</div>
{secondaryNavigationMarkup}
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,20 @@ export function Section({

const toggleRollup = rollup && items.length > rollup.after && (
<div className={styles.ListItem} key="List Item">
<button
type="button"
className={toggleClassName}
onClick={toggleExpanded}
aria-label={ariaLabel}
>
<span className={styles.Icon}>
<Icon source={HorizontalDotsMinor} />
</span>
</button>
<div className={styles.ItemWrapper}>
<div className={styles.ItemInnerWrapper}>
<button
type="button"
className={toggleClassName}
onClick={toggleExpanded}
aria-label={ariaLabel}
>
<span className={styles.Icon}>
<Icon source={HorizontalDotsMinor} />
</span>
</button>
</div>
</div>
</div>
);

Expand Down