From 02e1b402e5720cf6742e5d4ca39ebf383f3ebd48 Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Thu, 21 May 2026 10:02:11 -0700 Subject: [PATCH] fix(frontend): blur upload button so "Upload File" tooltip doesn't persist after file picker closes (#13178) fix(frontend): blur upload button so tooltip doesn't persist after file picker closes On the My Files page, clicking the "Upload Files" button kept the "Upload File" tooltip visible after the OS file picker closed. The button is wrapped in a Radix tooltip, which shows on focus; when the file dialog closed, focus was restored to the button and re-triggered the tooltip. Blur the button on click so focus doesn't return to it. Also tighten pre-existing `any` types in FilesTab to satisfy the no-explicit-any lint rule on the staged file. --- .../__tests__/categoryGroup.test.tsx | 35 +++++++++++++++---- .../pages/filesPage/components/FilesTab.tsx | 20 +++++++---- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/frontend/src/pages/FlowPage/components/flowSidebarComponent/components/__tests__/categoryGroup.test.tsx b/src/frontend/src/pages/FlowPage/components/flowSidebarComponent/components/__tests__/categoryGroup.test.tsx index 331eee53be..8c14bd86fe 100644 --- a/src/frontend/src/pages/FlowPage/components/flowSidebarComponent/components/__tests__/categoryGroup.test.tsx +++ b/src/frontend/src/pages/FlowPage/components/flowSidebarComponent/components/__tests__/categoryGroup.test.tsx @@ -1,30 +1,48 @@ import { render, screen } from "@testing-library/react"; -import React from "react"; +import type { ReactNode } from "react"; import { CategoryGroup } from "../categoryGroup"; +type MockChildrenProps = { + children?: ReactNode; + className?: string; +}; + +type MockCategoryDisclosureProps = { + item: { name: string; display_name: string }; + openCategories: string[]; +}; + +type MockSearchConfigTriggerProps = { + showConfig: boolean; + setShowConfig: (value: boolean) => void; +}; + // Mock the UI components jest.mock("@/components/ui/sidebar", () => ({ - SidebarGroup: ({ children, className }: any) => ( + SidebarGroup: ({ children, className }: MockChildrenProps) => (
{children}
), - SidebarGroupContent: ({ children }: any) => ( + SidebarGroupContent: ({ children }: MockChildrenProps) => (
{children}
), - SidebarGroupLabel: ({ children, className }: any) => ( + SidebarGroupLabel: ({ children, className }: MockChildrenProps) => (
{children}
), - SidebarMenu: ({ children }: any) => ( + SidebarMenu: ({ children }: MockChildrenProps) => (
{children}
), })); // Mock the CategoryDisclosure component jest.mock("../categoryDisclouse", () => ({ - CategoryDisclosure: ({ item, openCategories }: any) => ( + CategoryDisclosure: ({ + item, + openCategories, + }: MockCategoryDisclosureProps) => (
CategoryDisclosure for {item.display_name} - Open:{" "} {openCategories.includes(item.name).toString()} @@ -42,7 +60,10 @@ jest.mock("@/utils/styleUtils", () => ({ // Mock the SearchConfigTrigger component jest.mock("../searchConfigTrigger", () => ({ - SearchConfigTrigger: ({ showConfig, setShowConfig }: any) => ( + SearchConfigTrigger: ({ + showConfig, + setShowConfig, + }: MockSearchConfigTriggerProps) => (