Skip to content

Commit

Permalink
refactor: remove obsolete overlay positioning logic (#4637) (#4638)
Browse files Browse the repository at this point in the history
Co-authored-by: Sascha Ißbrücker <[email protected]>
  • Loading branch information
vaadin-bot and sissbruecker authored Sep 26, 2022
1 parent a988189 commit 65a8cbd
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions packages/menu-bar/src/vaadin-menu-bar-interactions-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const InteractionsMixin = (superClass) =>

const overlay = this._subMenu.$.overlay;
overlay.addEventListener('keydown', this.__boundOnContextMenuKeydown);
overlay.addEventListener('vaadin-overlay-open', this.__alignOverlayPosition.bind(this));

const container = this._container;
container.addEventListener('click', this.__onButtonClick.bind(this));
Expand Down Expand Up @@ -202,30 +201,6 @@ export const InteractionsMixin = (superClass) =>
return this.shadowRoot.querySelector('vaadin-menu-bar-submenu');
}

/** @private */
__alignOverlayPosition(e) {
/* c8 ignore next */
if (!this._expandedButton) {
// When `openOnHover` is true, quickly moving cursor can close submenu,
// so by the time when event listener gets executed button is null.
// See https://github.com/vaadin/vaadin-menu-bar/issues/85
return;
}
const overlay = e.target;
const { width, height, left } = this._expandedButton.getBoundingClientRect();
if (overlay.hasAttribute('bottom-aligned')) {
overlay.style.bottom = `${parseInt(getComputedStyle(overlay).bottom) + height}px`;
}
const endAligned = overlay.hasAttribute('end-aligned');
if (endAligned) {
if (this.__isRTL) {
overlay.style.left = `${left}px`;
} else {
overlay.style.right = `${parseInt(getComputedStyle(overlay).right) - width}px`;
}
}
}

/** @private */
_itemsChanged() {
const subMenu = this._subMenu;
Expand Down

0 comments on commit 65a8cbd

Please sign in to comment.