Skip to content

fix(treeselect): reset selfClick after overlay click to prevent doubl…#8567

Open
VaishnaviD5900 wants to merge 1 commit into
primefaces:masterfrom
VaishnaviD5900:fix/treeselect-header-click-outside
Open

fix(treeselect): reset selfClick after overlay click to prevent doubl…#8567
VaishnaviD5900 wants to merge 1 commit into
primefaces:masterfrom
VaishnaviD5900:fix/treeselect-header-click-outside

Conversation

@VaishnaviD5900
Copy link
Copy Markdown

Description

Fixes #7966

When clicking on the header slot of a TreeSelect, the click-outside-to-close
functionality required two outside clicks to close the panel instead of one.

Root Cause

onOverlayClick sets selfClick = true when the overlay is clicked, which
is correct for preventing the panel from closing. However it was never reset
after the interaction completed, causing the next outside click to be
incorrectly treated as a self-click and ignored.

Fix

Added a setTimeout(() => { this.selfClick = false }, 0) at the end of
onOverlayClick to reset the flag after all click events from that
interaction have fired.

How to Test

  1. Go to /treeselect/#template
  2. Open the TreeSelect panel
  3. Click the header area ("Available Files")
  4. Click outside — panel should close on first click ✅

Closes

Closes #7966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TreeSelect - Clicking on the Header will break the clickOutsideToClose functionality

1 participant