Skip to content

Commit

Permalink
fix: pointer position when using fixed positioning and custom offset (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dbatiste authored Dec 16, 2024
1 parent c9244c0 commit 83a09e5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/dropdown/dropdown-content-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ export const DropdownContentMixin = superclass => class extends LocalizeCoreElem
}
}
if (this.openedAbove) {
position.bottom = window.innerHeight - targetRect.top + 8;
position.bottom = window.innerHeight - targetRect.top + this._verticalOffset - 8;
} else {
position.top = targetRect.top + targetRect.height + this._verticalOffset - 7;
}
Expand Down
1 change: 1 addition & 0 deletions components/dropdown/test/dropdown-content.vdiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('dropdown-content', () => {
{ name: 'no-padding-no-pointer', content: html`<d2l-dropdown-content no-padding no-pointer opened>${basicText}</d2l-dropdown-content>` },
{ name: 'scroll-bottom-shadow', content: html`<d2l-dropdown-content opened>${scroll}</d2l-dropdown-content>` },
{ name: 'vertical-offset', dropdownStyles: { left: '50%' }, content: html`<d2l-dropdown-content vertical-offset="100" opened>${basicText}</d2l-dropdown-content>` },
{ name: 'vertical-offset-above', dropdownStyles: { bottom: '30px', left: '50%' }, content: html`<d2l-dropdown-content vertical-offset="100" opened>${basicText}</d2l-dropdown-content>` },
{ name: 'vertical-offset-edge', dropdownStyles: { left: '50%' }, content: html`<d2l-dropdown-content vertical-offset="100" opened>${longerText}</d2l-dropdown-content>` },
{ name: 'vertical-offset-negative', dropdownStyles: { left: '50%' }, content: html`<d2l-dropdown-content vertical-offset="-25" opened>${blockText}</d2l-dropdown-content>` },
{ name: 'boundary-left-below', dropdownStyles: { left: '50%', top: '50%' }, content: html`<d2l-dropdown-content boundary="{&quot;left&quot;:50, &quot;below&quot;:20}" opened>${longerText}</d2l-dropdown-content>` },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/popover/popover-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export const PopoverMixin = superclass => class extends superclass {
}

if (this._location === 'block-start') {
position.bottom = window.innerHeight - openerRect.top + 8;
position.bottom = window.innerHeight - openerRect.top + this._offset - 8;
} else {
position.top = openerRect.top + openerRect.height + this._offset - 7;
}
Expand Down

0 comments on commit 83a09e5

Please sign in to comment.