Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Enable scrolling inside browser extension autofill popup (#2066)

Leendert de Borst3da3b4ec5291
diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
index 7d19b3f99..68057ec47 100644
--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts
@@ -664,6 +664,43 @@ export function createBasePopup(input: HTMLInputElement, rootContainer: HTMLElem
// Append popup to the root container
rootContainer.appendChild(popup);
+ /*
+ * Some websites embed the login form inside an iframe. We constrain the popup to
+ * the (i)frame viewport so it doesn't get clipped inside small iframes.
+ * Instead, this will allow the popup to scroll internally if needed.
+ */
+ requestAnimationFrame(() => {
+ const viewportHeight = window.innerHeight;
+ const viewportWidth = window.innerWidth;
+ const margin = 8;
+ const spaceBelow = viewportHeight - inputRect.bottom - margin;
+ const spaceAbove = inputRect.top - margin;
+
+ let availableHeight = spaceBelow;
+ if (spaceBelow < 160 && spaceAbove > spaceBelow) {
+ // Flip above the input
+ const popupHeight = popup.offsetHeight;
+ const constrainedHeight = Math.min(popupHeight, spaceAbove);
+ const newTop = useFixedPositioning
+ ? inputRect.top - constrainedHeight - 4
+ : inputRect.top - rootContainerRect.top - constrainedHeight - 4;
+ popup.style.top = `${newTop}px`;
+ availableHeight = spaceAbove;
+ }
+
+ popup.style.maxHeight = `${Math.max(80, availableHeight)}px`;
+ popup.style.overflowY = 'auto';
+
+ // Clamp horizontally so the popup stays inside the viewport
+ const popupWidth = popup.offsetWidth;
+ if (inputRect.left + popupWidth > viewportWidth - margin) {
+ const newLeft = Math.max(margin, viewportWidth - popupWidth - margin);
+ popup.style.left = useFixedPositioning
+ ? `${newLeft}px`
+ : `${newLeft - rootContainerRect.left}px`;
+ }
+ });
+
return popup;
}
diff --git a/apps/browser-extension/src/entrypoints/contentScript/style.css b/apps/browser-extension/src/entrypoints/contentScript/style.css
index cd3d0601c..c2cf0b3a6 100644
--- a/apps/browser-extension/src/entrypoints/contentScript/style.css
+++ b/apps/browser-extension/src/entrypoints/contentScript/style.css
@@ -376,8 +376,11 @@ body {
background: rgba(0, 0, 0, 0.5);
z-index: 2147483647;
display: flex;
- align-items: center;
+ align-items: flex-start;
justify-content: center;
+ overflow-y: auto;
+ padding: 8px 0;
+ box-sizing: border-box;
}
.av-create-popup {
@@ -391,13 +394,18 @@ body {
0 20px 25px -5px rgba(0, 0, 0, 0.1);
width: 400px;
max-width: 90vw;
+ max-height: calc(100vh - 16px);
+ margin: auto;
+ overflow-y: auto;
transform: scale(0.95);
opacity: 0;
padding: 16px 24px;
+ box-sizing: border-box;
transition: transform 0.2s ease, opacity 0.2s ease;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
font-size: 14px;
line-height: 1.4;
+ scrollbar-width: thin;
}
.av-create-popup.show {