Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep the whole session picker inside the chat layout

Yudhi Armyndharisd1352f7be813
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index d3fe9ce3b..fbd5327b1 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -151,6 +151,8 @@
border-inline-end: 1px solid var(--chat-divider);
flex-shrink: 0;
min-height: 0;
+ /* The session picker hangs from the column (see .session-picker). */
+ position: relative;
}
/* As high as the room header beside it. Layout.css gives the dashboard's own .sidebar-header a 72px minimum, which
@@ -171,7 +173,6 @@
/* Session switcher: the selected account in the header, opening a searchable list of every session. */
.chats-page .session-switcher {
- position: relative;
min-width: 0;
}
@@ -330,13 +331,16 @@
transform: rotate(180deg);
}
-/* The open list */
+/* The open list. The chat layout clips what runs past its bottom edge, so the list is placed against the list column
+ (under its 64px header, at the switcher's start edge) and capped by the column's height: the sessions scroll inside
+ it, and the search row and the pairing link stay in reach on a short window or a phone held sideways. */
.chats-page .session-picker {
position: absolute;
- top: calc(100% + 0.5rem);
- inset-inline-start: -0.25rem;
+ top: calc(64px + 0.25rem);
+ inset-inline-start: 0.75rem;
z-index: 30;
width: min(360px, calc(100vw - 2rem));
+ max-height: calc(100% - 64px - 0.75rem);
display: flex;
flex-direction: column;
background: var(--chat-panel);
diff --git a/dashboard/src/pages/Chats.css.test.ts b/dashboard/src/pages/Chats.css.test.ts
index 5dd166932..8d204a7ad 100644
--- a/dashboard/src/pages/Chats.css.test.ts
+++ b/dashboard/src/pages/Chats.css.test.ts
@@ -55,3 +55,19 @@ test('the chat list header is as high as the room header, whatever minimum the d
'the dashboard minimum stretches the chat list header',
);
});
+
+test('the session picker is capped by the list column, so the layout never clips its last sessions or its link', () => {
+ // .chats-layout clips what runs past it; the picker hung from the switcher had no cap but the list's own 360px.
+ const declared = (selector: string, property: string): string | undefined =>
+ rulesFor(selector)
+ .map(body => new RegExp(`(?:^|;)\\s*${property}:\\s*([^;]+)`).exec(body)?.[1].trim())
+ .filter(Boolean)
+ .pop();
+ assert.equal(declared('.chats-page .chats-layout', 'overflow'), 'hidden');
+ assert.equal(declared('.chats-page .chats-sidebar', 'position'), 'relative');
+ assert.equal(declared('.chats-page .session-switcher', 'position'), undefined, 'the switcher holds the picker');
+ assert.equal(declared('.chats-page .session-picker', 'position'), 'absolute');
+ assert.match(declared('.chats-page .session-picker', 'max-height') ?? '', /^calc\(100% - /);
+ assert.equal(declared('.chats-page .session-picker', 'overflow'), 'hidden');
+ assert.equal(declared('.chats-page .session-picker-list', 'overflow-y'), 'auto');
+});