Skip to content

Commit

Permalink
fix(form): activate PTE input when dragging files (#6929)
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Carlsen <fred@sjelfull.no>
  • Loading branch information
sjelfull committed Jun 13, 2024
1 parent 18aee90 commit f589698
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ export function ActivateOnFocus(props: ActivateOnFocusProps) {
[isOverlayActive, onActivate],
)

const handleDragEnter = useCallback(() => {
if (!isOverlayActive) {
return
}
if (onActivate) {
onActivate()
}
}, [isOverlayActive, onActivate])

const handleOnFocus = useCallback(() => {
setFocused(true)
}, [])
Expand Down Expand Up @@ -86,6 +95,7 @@ export function ActivateOnFocus(props: ActivateOnFocusProps) {
onClick={handleClick}
onFocus={handleOnFocus}
onKeyDown={handleKeyDown}
onDragEnter={handleDragEnter}
>
{isOverlayActive && (
<FlexContainer data-testid="activate-overlay" tabIndex={0} align="center" justify="center">
Expand Down

0 comments on commit f589698

Please sign in to comment.