diff --git a/CHANGELOG.md b/CHANGELOG.md index 7443d48a3..141675e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Missing flag handling in ColorMyWorld #1603 - Position of Sugar Icon in Popup on homescreen is toward bottom right #1662 - Recording video doesn't work on Windows #1203 +- Activity Description opening downwards in Journal #1407 ## [1.8.0] - 2024-04-10 ### Added diff --git a/js/journal.js b/js/journal.js index 372e1dcd6..bf610dfe3 100644 --- a/js/journal.js +++ b/js/journal.js @@ -703,7 +703,20 @@ enyo.kind({ this.$.activityPopup.setFooter(items); // Show popup - this.$.activityPopup.setMargin({left: 0, top: (icon.owner.index*60)+20-mouse.position.y}); + // Get the popup's size dynamically + var popupSize = 50; // Base header size + popupSize += (items.length * 42); // Add height for each item + var leftPostion = 0; + var topPosition = (icon.owner.index * 60) + 20 - mouse.position.y; + var bottomOverflow = mouse.position.y + popupSize - window.innerHeight+55; + if (bottomOverflow > 0) { + // If the popup overflows the bottom, adjust upwards + topPosition -= bottomOverflow; + if(!this.$.footer.getShowing()){ + topPosition += 55; // HACK: 55 is the footer height + } + } + this.$.activityPopup.setMargin({ left: leftPostion, top: topPosition }); this.$.activityPopup.showPopup(); },