From 3e2e2dae24640c6d679a5ef156de897055174f84 Mon Sep 17 00:00:00 2001 From: "Aimane Chnaif (via MelvinBot)" Date: Wed, 18 Mar 2026 21:59:04 +0000 Subject: [PATCH] Prevent FAB menu item icons from turning green on reopen When focusedIndex is -1 (initial/reset state) and an unregistered item also has itemIndex -1, the equality check incorrectly marks the item as focused. Add an explicit guard so isFocused is only true when focusedIndex is a valid non-negative index. Co-authored-by: Aimane Chnaif --- src/pages/inbox/sidebar/FABPopoverContent/useFABMenuItem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/inbox/sidebar/FABPopoverContent/useFABMenuItem.ts b/src/pages/inbox/sidebar/FABPopoverContent/useFABMenuItem.ts index f69474052d6fa..1be0341700d2c 100644 --- a/src/pages/inbox/sidebar/FABPopoverContent/useFABMenuItem.ts +++ b/src/pages/inbox/sidebar/FABPopoverContent/useFABMenuItem.ts @@ -32,7 +32,7 @@ function useFABMenuItem(itemId: string, isVisible = true): FABMenuItemResult { }, [isVisible, itemId, registerItem, unregisterItem]); const itemIndex = registeredItems.indexOf(itemId); - const isFocused = focusedIndex === itemIndex; + const isFocused = focusedIndex !== -1 && focusedIndex === itemIndex; const wrapperStyle = StyleUtils.getItemBackgroundColorStyle(false, isFocused, false, theme.activeComponentBG, theme.hoverComponentBG); return {itemIndex, isFocused, wrapperStyle, setFocusedIndex, onItemPress};