commit 70c2be547b0147c72b026d9e5d1b6b0ac141bbad parent 24e17c8f1445887b1c9907a620aad3b6d88b6072 Author: Harsheet <hsohaney@mozilla.com> Date: Thu, 13 Nov 2025 19:58:22 +0000 Bug 1999461 - Add support for RTL positioning for the backup password tooltip. r=cdupuis Screenshots of the fix for reference {F38542302} {F38542303} {F38542305} Differential Revision: https://phabricator.services.mozilla.com/D272315 Diffstat:
| M | browser/components/backup/content/password-rules-tooltip.mjs | | | 22 | +++++++++------------- |
| M | browser/components/backup/content/password-validation-inputs.mjs | | | 1 | + |
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/browser/components/backup/content/password-rules-tooltip.mjs b/browser/components/backup/content/password-rules-tooltip.mjs @@ -67,22 +67,18 @@ export default class PasswordRulesTooltip extends MozLitElement { positionPopover() { const anchorRect = this.getBoundingClientRect(); + const popover = this.passwordRulesEl; const isWideViewport = window.innerWidth >= 1200; + const isRTL = document.dir === "rtl"; - const leftPos = anchorRect.left; - if (isWideViewport) { - // Position to the right of the input - const topPos = anchorRect.top; + // Calculate top position + const topPos = isWideViewport + ? anchorRect.top + anchorRect.height / 2 + : anchorRect.bottom; - this.passwordRulesEl.style.left = `${leftPos}px`; - this.passwordRulesEl.style.top = `${topPos}px`; - } else { - // Position below the input - const topPos = anchorRect.bottom; - - this.passwordRulesEl.style.left = `${leftPos}px`; - this.passwordRulesEl.style.top = `${topPos}px`; - } + popover.style.top = `${topPos}px`; + popover.style.right = isRTL ? "auto" : "inherit"; + popover.style.left = isRTL ? "inherit" : "auto"; } _onBeforeToggle(e) { diff --git a/browser/components/backup/content/password-validation-inputs.mjs b/browser/components/backup/content/password-validation-inputs.mjs @@ -87,6 +87,7 @@ export default class PasswordValidationInputs extends MozLitElement { this._tooShort = true; this._passwordsMatch = false; this._passwordsValid = false; + this.passwordRulesEl.hide(); } handleFocusNewPassword() {