From c0c1b557ebcd76fecc7b305115cbabe921b38e0d Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Sun, 21 Oct 2018 08:53:45 -0700 Subject: [PATCH] Problem: revealed dropdown menu on mobiles (#3491) On mobile phones, tiddler's dropdown menu stays partially off-screen. Solution: ensure that the revealed coordinates are never negative Closes #3486 --- core/modules/widgets/reveal.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/widgets/reveal.js b/core/modules/widgets/reveal.js index fed6de0e9..bc95127f0 100755 --- a/core/modules/widgets/reveal.js +++ b/core/modules/widgets/reveal.js @@ -58,23 +58,23 @@ RevealWidget.prototype.positionPopup = function(domNode) { domNode.style.zIndex = "1000"; switch(this.position) { case "left": - domNode.style.left = (this.popup.left - domNode.offsetWidth) + "px"; + domNode.style.left = Math.max(0, this.popup.left - domNode.offsetWidth) + "px"; domNode.style.top = this.popup.top + "px"; break; case "above": domNode.style.left = this.popup.left + "px"; - domNode.style.top = (this.popup.top - domNode.offsetHeight) + "px"; + domNode.style.top = Math.max(0, this.popup.top - domNode.offsetHeight) + "px"; break; case "aboveright": domNode.style.left = (this.popup.left + this.popup.width) + "px"; - domNode.style.top = (this.popup.top + this.popup.height - domNode.offsetHeight) + "px"; + domNode.style.top = Math.max(0, this.popup.top + this.popup.height - domNode.offsetHeight) + "px"; break; case "right": domNode.style.left = (this.popup.left + this.popup.width) + "px"; domNode.style.top = this.popup.top + "px"; break; case "belowleft": - domNode.style.left = (this.popup.left + this.popup.width - domNode.offsetWidth) + "px"; + domNode.style.left = Math.max(0, this.popup.left + this.popup.width - domNode.offsetWidth) + "px"; domNode.style.top = (this.popup.top + this.popup.height) + "px"; break; default: // Below