Skip to content

Commit

Permalink
Merge pull request #1368 from plone/relateditems-infiniteloading-issue
Browse files Browse the repository at this point in the history
Fix relateditems select2 results dropdown/up
  • Loading branch information
petschki authored Feb 26, 2024
2 parents 13ba508 + 0ecd52d commit 07dd8ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pat/relateditems/relateditems.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,12 @@ export default Base.extend({
this.renderToolbar();
this.$el.on("select2-loaded", () => {
let yMax = window.innerHeight || document.documentElement.clientHeight;
const relitem_rect = this.el.parentElement.getBoundingClientRect();
const element = $(
".pat-relateditems-dropdown.select2-drop-active .select2-results"
"#select2-drop.pat-relateditems-dropdown.select2-drop-active .select2-results"
)[0];
const rect = element.getBoundingClientRect();
const maxHeight = yMax - rect.top - 18;
const maxHeight = ((relitem_rect.top > rect.top) ? relitem_rect.top : yMax - rect.top) - 18;
$(element).css("max-height", `${maxHeight}px`);
});

Expand Down

0 comments on commit 07dd8ca

Please sign in to comment.