From 8b0488d71e82dfa6aaed3073c23e4bc7b5611e21 Mon Sep 17 00:00:00 2001 From: Monica Kozbial Date: Tue, 9 Mar 2021 11:32:10 -0800 Subject: [PATCH] Fix flyout scrollbar reposition edge case (#4693) * Fix flyout scrollbar position --- core/flyout_base.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/flyout_base.js b/core/flyout_base.js index 280d2eaba..4aca6b9f2 100644 --- a/core/flyout_base.js +++ b/core/flyout_base.js @@ -441,6 +441,17 @@ Blockly.Flyout.prototype.positionAt_ = function(width, height, x, y) { // Set the scrollbars origin to be the top left of the flyout. scrollbar.setOrigin(x, y); scrollbar.resize(); + // If origin changed and metrics haven't changed enough to trigger + // reposition in resize, we need to call setPosition. See issue #4692. + if (scrollbar.hScroll) { + scrollbar.hScroll.setPosition( + scrollbar.hScroll.position.x, scrollbar.hScroll.position.y); + } + if (scrollbar.vScroll) { + scrollbar.vScroll.setPosition( + scrollbar.vScroll.position.x, scrollbar.vScroll.position.y); + + } } };