Skip to content

Commit

Permalink
Origin/cx 16499 menu overlapping border fix (#1797)
Browse files Browse the repository at this point in the history
* fix: overlapping border on menu

fixing the overlapping visible border on the menu by bringing the css pointer to the front and adding a border around the new pointer position

* fix: removing bottom dropshadow

dropshadow is not needed when menu opens down from trigger as the shadow is offset down so top edge of menu will not have shadow, so pointer won't need shadow
  • Loading branch information
mruane1 authored Nov 1, 2024
1 parent f632bf0 commit e8e9782
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
1 change: 1 addition & 0 deletions web-components/src/components/menu-overlay/MenuOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export namespace MenuOverlay {
onFirstUpdate: async () => {
// We need to find all focusable elements, after Popper finish its positioning calculation
if (this.isOpen) {
this.popperInstance?.update();
this.setFocusableElements!();
await this.updateComplete;
this.focusInsideOverlay();
Expand Down
48 changes: 41 additions & 7 deletions web-components/src/components/menu-overlay/scss/menu-overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
}

.overlay-arrow {
filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.16));
height: 0;
visibility: hidden;
width: 0;
z-index: -1;

&[data-show] {
visibility: visible;
Expand All @@ -48,28 +46,64 @@
.overlay-container[data-popper-placement^="top"] > .overlay-arrow {
border-left: solid $arrow-size transparent;
border-right: solid $arrow-size transparent;
border-top: solid $arrow-size var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
border-top: solid $arrow-size var(--md-menu-overlay-border-color, --gray-20);
bottom: $arrow-offset;
filter: drop-shadow(0px 14px 8px rgba(0, 0, 0, 0.16));
}

.overlay-container[data-popper-placement^="bottom"] > .overlay-arrow {
border-bottom: solid $arrow-size var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
border-bottom: solid $arrow-size var(--md-menu-overlay-border-color, --gray-20);
border-left: solid $arrow-size transparent;
border-right: solid $arrow-size transparent;
top: $arrow-offset;
}

.overlay-container[data-popper-placement^="right"] > .overlay-arrow {
border-bottom: solid $arrow-size transparent;
border-right: solid $arrow-size var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
border-right: solid $arrow-size var(--md-menu-overlay-border-color, --gray-20);
border-top: solid $arrow-size transparent;
left: $arrow-offset;
filter: drop-shadow(-16px 0px 10px rgba(0, 0, 0, 0.16));
}

.overlay-container[data-popper-placement^="left"] > .overlay-arrow {
border-bottom: solid $arrow-size transparent;
border-left: solid $arrow-size var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
border-left: solid $arrow-size var(--md-menu-overlay-border-color, --gray-20);
border-top: solid $arrow-size transparent;
right: $arrow-offset;
filter: drop-shadow(16px 0px 10px rgba(0, 0, 0, 0.16));
}
}

.overlay-container > .overlay-arrow:after {
content: "";
position: absolute;
border-width: 19px;
border-style: solid;
border-color: transparent;
}

// styling to create triangle border to match menu for pointer
.overlay-container[data-popper-placement^="top"] > .overlay-arrow:after {
border-top-color: var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
bottom: -17px;
right: -19px;
}

.overlay-container[data-popper-placement^="bottom"] > .overlay-arrow:after {
border-bottom-color: var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
top: -17px;
left: -19px;
}

.overlay-container[data-popper-placement^="right"] > .overlay-arrow:after {
border-right-color: var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
bottom: -19px;
left: -17px;
}

.overlay-container[data-popper-placement^="left"] > .overlay-arrow:after {
border-left-color: var(--md-menu-overlay-arrow-bg-color, var(--md-tertiary-white-bg-color));
top: -19px;
right: -17px;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$arrow-size: rem-calc(16);
$arrow-offset: rem-calc(2) - $arrow-size;
$arrow-offset: rem-calc(0.8) - $arrow-size;

:host {
--vw-padding: 16px;
Expand Down

0 comments on commit e8e9782

Please sign in to comment.