From aadb5ccc35514c3de85c6ad39bc4346c33fa2d8d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 9 Jul 2019 18:57:05 +0200 Subject: [PATCH] Prevent the quote overlay from overflowing the container --- wcfsetup/install/files/js/WCF.Message.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 94fede9a15..de5ba71b48 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -1303,6 +1303,15 @@ if (COMPILER_TARGET_DEFAULT) { var $dimensions = this._copyQuote.getDimensions('outer'); var $left = ($coordinates.right - $coordinates.left) / 2 - ($dimensions.width / 2) + $coordinates.left; + // Prevent the overlay from overflowing the left or right boundary of the container. + var containerBoundaries = $container[0].getBoundingClientRect(); + if ($left < containerBoundaries.left) { + $left = containerBoundaries.left; + } + else if ($left + $dimensions.width > containerBoundaries.right) { + $left = containerBoundaries.right - $dimensions.width; + } + this._copyQuote.css({ top: $coordinates.bottom + 7 + 'px', left: $left + 'px' -- 2.20.1