File tree Expand file tree Collapse file tree 5 files changed +59
-42
lines changed
polaris-react/src/components/Navigation Expand file tree Collapse file tree 5 files changed +59
-42
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @shopify/polaris ' : patch
3+ ---
4+
5+ Extends Navigation Item highlight to full width to cover secondary actions
Original file line number Diff line number Diff line change @@ -92,18 +92,11 @@ $disabled-fade: 0.6;
9292.Item {
9393 @include nav-item-attributes ;
9494 position : relative ;
95-
96- margin-inline-start : var (--p-space-2 );
97-
98- & :last-child {
99- margin-inline-end : var (--p-space-2 );
100- }
10195}
10296
10397.Item-selected {
10498 font-weight : var (--p-font-weight-semibold );
10599 color : var (--p-text-primary );
106- background-color : var (--p-background-selected );
107100 outline : var (--p-border-width-1 ) solid transparent ;
108101
109102 & ::before {
@@ -203,9 +196,24 @@ $disabled-fade: 0.6;
203196}
204197
205198.ItemWrapper {
199+ width : 100% ;
200+ padding : 0 var (--p-space-2 );
201+ }
202+
203+ .ItemInnerWrapper {
206204 display : flex ;
207205 flex-wrap : nowrap ;
208206 width : 100% ;
207+
208+ & :hover {
209+ background : var (--p-background-hovered );
210+ color : var (--p-text );
211+ text-decoration : none ;
212+ }
213+ }
214+
215+ .ItemInnerWrapper-Selected {
216+ background-color : var (--p-background-selected );
209217}
210218
211219.Text {
@@ -238,8 +246,7 @@ $disabled-fade: 0.6;
238246 display : flex ;
239247 align-items : center ;
240248 height : nav (mobile-height );
241- padding : var (--p-space-1 ) var (--p-space-4 );
242- margin-right : var (--p-space-1 );
249+ padding : var (--p-space-1 ) var (--p-space-3 ) var (--p-space-1 ) var (--p-space-4 );
243250 border-radius : var (--p-border-radius-1 );
244251
245252 @media #{$p-breakpoints-md-up } {
Original file line number Diff line number Diff line change @@ -34,12 +34,6 @@ $nav-animation-variables: (
3434 text-decoration : none ;
3535 text-align : left ;
3636
37- & :hover {
38- background : var (--p-background-hovered );
39- color : var (--p-text );
40- text-decoration : none ;
41- }
42-
4337 @include focus-ring ;
4438
4539 & .keyFocused {
Original file line number Diff line number Diff line change @@ -315,25 +315,32 @@ export function Item({
315315 return (
316316 < li className = { className } >
317317 < div className = { styles . ItemWrapper } >
318- < UnstyledLink
319- url = { url }
320- className = { itemClassName }
321- external = { external }
322- tabIndex = { tabIndex }
323- aria-disabled = { disabled }
324- aria-label = { accessibilityLabel }
325- onClick = { getClickHandler ( onClick ) }
326- onKeyUp = { handleKeyUp }
327- onBlur = { handleBlur }
328- { ...normalizeAriaAttributes (
329- secondaryNavigationId ,
330- subNavigationItems . length > 0 ,
331- showExpanded ,
318+ < div
319+ className = { classNames (
320+ styles . ItemInnerWrapper ,
321+ selected && canBeActive && styles [ 'ItemInnerWrapper-Selected' ] ,
332322 ) }
333323 >
334- { itemContentMarkup }
335- </ UnstyledLink >
336- { secondaryActionMarkup }
324+ < UnstyledLink
325+ url = { url }
326+ className = { itemClassName }
327+ external = { external }
328+ tabIndex = { tabIndex }
329+ aria-disabled = { disabled }
330+ aria-label = { accessibilityLabel }
331+ onClick = { getClickHandler ( onClick ) }
332+ onKeyUp = { handleKeyUp }
333+ onBlur = { handleBlur }
334+ { ...normalizeAriaAttributes (
335+ secondaryNavigationId ,
336+ subNavigationItems . length > 0 ,
337+ showExpanded ,
338+ ) }
339+ >
340+ { itemContentMarkup }
341+ </ UnstyledLink >
342+ { secondaryActionMarkup }
343+ </ div >
337344 </ div >
338345 { secondaryNavigationMarkup }
339346 </ li >
Original file line number Diff line number Diff line change @@ -139,16 +139,20 @@ export function Section({
139139
140140 const toggleRollup = rollup && items . length > rollup . after && (
141141 < div className = { styles . ListItem } key = "List Item" >
142- < button
143- type = "button"
144- className = { toggleClassName }
145- onClick = { toggleExpanded }
146- aria-label = { ariaLabel }
147- >
148- < span className = { styles . Icon } >
149- < Icon source = { HorizontalDotsMinor } />
150- </ span >
151- </ button >
142+ < div className = { styles . ItemWrapper } >
143+ < div className = { styles . ItemInnerWrapper } >
144+ < button
145+ type = "button"
146+ className = { toggleClassName }
147+ onClick = { toggleExpanded }
148+ aria-label = { ariaLabel }
149+ >
150+ < span className = { styles . Icon } >
151+ < Icon source = { HorizontalDotsMinor } />
152+ </ span >
153+ </ button >
154+ </ div >
155+ </ div >
152156 </ div >
153157 ) ;
154158
You can’t perform that action at this time.
0 commit comments