From a9ef73607dd220b6d185aadd4887954b0a254079 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Mon, 29 Sep 2025 22:00:52 +0200 Subject: [PATCH] FolderPicker: Fix expand toggle also selecting folder (#111755) Fix selecting folder on expand --- .../core/components/NestedFolderPicker/NestedFolderList.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx b/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx index aa099cff928..1b9bea1c415 100644 --- a/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx +++ b/public/app/core/components/NestedFolderPicker/NestedFolderList.tsx @@ -204,6 +204,11 @@ function Row({ index, style: virtualStyles, data }: RowProps) { // by using onMouseDown here instead of onClick we can stop focus moving // to the button when the user clicks it (via preventDefault + stopPropagation) onMouseDown={handleExpand} + // Additionally, prevent the click event from bubbling to the row, which would select the folder + onClick={(ev) => { + ev.preventDefault(); + ev.stopPropagation(); + }} // tabIndex not needed here because we handle keyboard navigation at the input level tabIndex={-1} aria-label={isOpen ? `Collapse folder ${item.title}` : `Expand folder ${item.title}`}