Skip to content

Commit b5f4f6d

Browse files
yihuiliaoLFDanLu
andauthored
Fix focus going to the DropZone after closing FileTrigger (#5867)
* Fix focus going to the DropZone after closing FileTrigger * check event target * ensure that you can actually click anywhere to paste --------- Co-authored-by: Daniel Lu <dl1644@gmail.com>
1 parent acb7352 commit b5f4f6d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-aria-components/src/DropZone.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ function DropZone(props: DropZoneProps, ref: ForwardedRef<HTMLDivElement>) {
9191
{...renderProps}
9292
slot={props.slot || undefined}
9393
ref={ref}
94-
onClick={() => buttonRef.current?.focus()}
94+
onClick={(e) => {
95+
let target = e.target as HTMLElement;
96+
if (!target.matches('input')) {
97+
buttonRef.current?.focus();
98+
}
99+
}}
95100
data-hovered={isHovered || undefined}
96101
data-focused={isFocused || undefined}
97102
data-focus-visible={isFocusVisible || undefined}

0 commit comments

Comments
 (0)