From f75e4d3caa14bdeabba190d7465601e94aa97e03 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 18 Oct 2016 13:32:00 +0200 Subject: [PATCH] Add safety check in code for moving the handle An element that has 'display: none' has a height of zero, and the logic for the handle assumed that this was never the case. This could cause the handle to end up at the wrong coordinates. --- app/ui.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/ui.js b/app/ui.js index c73c69c..3ad9984 100644 --- a/app/ui.js +++ b/app/ui.js @@ -556,6 +556,11 @@ var UI; .getBoundingClientRect(); var margin = 10; + // These heights need to be non-zero for the below logic to work + if (handleHeight === 0 || controlbarBounds.height === 0) { + return; + } + var newY = viewportRelativeY; // Check if the coordinates are outside the control bar