From 02bfd90c40dcf2a064290cab0f4fc445af07c1d0 Mon Sep 17 00:00:00 2001 From: Jason Ross Date: Thu, 2 Jul 2026 16:38:32 -0500 Subject: [PATCH] fix(mailbox): anchor account-switcher dropdown to its trigger The TextButton trigger and its DropdownMenu in AccountSwitcher were siblings in the drawer's outer Column, so the dropdown's Popup anchored to the whole Column instead of the button. Wrap both in a shared Box, the standard Compose pattern, so the menu opens directly below the account switcher regardless of drawer scroll position or folder count. Closes #147 Co-Authored-By: Claude Opus 4.8 --- .../org/libremail/ui/mailbox/FolderDrawer.kt | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/app/src/main/kotlin/org/libremail/ui/mailbox/FolderDrawer.kt b/app/src/main/kotlin/org/libremail/ui/mailbox/FolderDrawer.kt index 9481e43..f922a87 100644 --- a/app/src/main/kotlin/org/libremail/ui/mailbox/FolderDrawer.kt +++ b/app/src/main/kotlin/org/libremail/ui/mailbox/FolderDrawer.kt @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later package org.libremail.ui.mailbox +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -126,32 +127,34 @@ private fun AccountSwitcher( onSelect: (String) -> Unit, ) { var expanded by remember { mutableStateOf(false) } - TextButton( - onClick = { expanded = true }, - modifier = Modifier.padding(horizontal = 16.dp), - ) { - Text( - current.email, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - fontWeight = if (current.id in accountsWithUnread) FontWeight.Bold else FontWeight.Normal, - ) - Icon(Icons.Filled.ArrowDropDown, contentDescription = stringResource(R.string.drawer_switch_account)) - } - DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { - accounts.forEach { account -> - DropdownMenuItem( - text = { - Text( - account.email, - fontWeight = if (account.id in accountsWithUnread) FontWeight.Bold else FontWeight.Normal, - ) - }, - onClick = { - onSelect(account.id) - expanded = false - }, + Box { + TextButton( + onClick = { expanded = true }, + modifier = Modifier.padding(horizontal = 16.dp), + ) { + Text( + current.email, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + fontWeight = if (current.id in accountsWithUnread) FontWeight.Bold else FontWeight.Normal, ) + Icon(Icons.Filled.ArrowDropDown, contentDescription = stringResource(R.string.drawer_switch_account)) + } + DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { + accounts.forEach { account -> + DropdownMenuItem( + text = { + Text( + account.email, + fontWeight = if (account.id in accountsWithUnread) FontWeight.Bold else FontWeight.Normal, + ) + }, + onClick = { + onSelect(account.id) + expanded = false + }, + ) + } } } } -- 2.47.3