From d698a64481cb824a5315484034ad6d01e649ebd9 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 3 Jun 2020 16:23:44 +0200 Subject: [PATCH] Calculate the drop down width based on the element offset, not the width This should make it work in all (LTR at least) cases. --- packages/auth/src/auth.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/auth/src/auth.js b/packages/auth/src/auth.js index 34b46fff..85e9223c 100644 --- a/packages/auth/src/auth.js +++ b/packages/auth/src/auth.js @@ -251,7 +251,9 @@ export class Auth extends ScopedElementsMixin(VPULitElement) { return; } - dropdown.setAttribute("style", `width: ${this.offsetWidth - 5}px`); + let viewportOffset = this.getBoundingClientRect(); + let spaceToRIght = window.innerWidth - viewportOffset.left; + dropdown.setAttribute("style", `width: ${spaceToRIght - 10}px`); } disconnectedCallback() { -- GitLab