Skip to content

Commit c9785d2

Browse files
committed
Remove z-index in the button
1 parent 98c5c88 commit c9785d2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

packages/uui-menu-item/lib/uui-menu-item.element.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
217217
render() {
218218
return html`
219219
<div id="menu-item" aria-label="menuitem" role="menuitem">
220+
<div id="label-button-background"></div>
220221
${this.hasChildren
221222
? html`<button
222223
id="caret-button"
@@ -231,7 +232,6 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
231232
? this._renderLabelAsAnchor()
232233
: this._renderLabelAsButton()}
233234
234-
<div id="label-button-background"></div>
235235
<slot id="actions-container" name="actions"></slot>
236236
${this.loading
237237
? html`<uui-loader-bar id="loader"></uui-loader-bar>`
@@ -265,13 +265,10 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
265265
}
266266
267267
/** Not active, not selected, not disabled: */
268+
/* Only when NOT active/selected/disabled/highlight … */
268269
:host(:not([active], [selected], [disabled], [select-mode='highlight']))
269-
#menu-item
270-
#label-button:hover
271-
~ #label-button-background,
272-
:host(:not([active], [selected], [disabled]))
273-
#menu-item
274-
#caret-button:hover {
270+
#menu-item:has(#label-button:hover)
271+
#label-button-background {
275272
background-color: var(
276273
--uui-menu-item-background-color-hover,
277274
var(--uui-color-surface-emphasis)
@@ -480,7 +477,7 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
480477
background-color: transparent;
481478
cursor: pointer;
482479
min-height: var(--uui-size-12);
483-
z-index: 1;
480+
//z-index: 1;
484481
}
485482
486483
#label-button {
@@ -498,7 +495,7 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
498495
text-decoration: none;
499496
color: currentColor;
500497
min-height: var(--uui-size-12);
501-
z-index: 1;
498+
//z-index: 1;
502499
font-weight: inherit;
503500
}
504501
@@ -557,12 +554,18 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
557554
558555
#badge {
559556
font-size: 12px;
557+
//Why is this duplicated?
560558
--uui-badge-position: relative;
561559
--uui-badge-position: auto;
562560
display: block;
563561
margin-left: 6px;
564562
}
565563
564+
#label-button ::slotted(uui-badge) {
565+
position: relative;
566+
z-index: 1;
567+
}
568+
566569
/** Focus styling */
567570
568571
:host([select-mode='highlight']) #label-button:focus-visible {

0 commit comments

Comments
 (0)