Fix: BlockUI mask blocking interactions during exit animation #8347
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
When the
blockedprop was toggled rapidly (e.g., fast API calls completing around 50-150ms), the BlockUI mask element would remain in the DOM during its exit animation and continue blocking pointer events. This prevented users from interacting with elements underneath, even though the visual overlay had faded out andisBlockedwasfalse.The problem was most noticeable during stress testing or rapid pagination where block/unblock cycles happened faster than the CSS animation duration (~300ms).
Reproducer link: https://stackblitz.com/edit/primevue-4-vite-issue-template-jg3s6cmh?file=src%2FBlockUITest.vue
closes #7817
Root Cause
The
unblock()method was settingisBlocked = falseonly after the exit animation completed (inremoveMask()). While the mask element remained in the DOM during the animation, it still had pointer events enabled, blocking all user interactions with the underlying content.Solution
Set
pointer-events: noneon the mask element immediately whenunblock()is called, before the exit animation begins:This allows click events to pass through the mask to the content below while the mask visually animates out. The mask element is still properly cleaned up after the animation completes.
Additionally, moved
isBlocked = falseand theunblockevent emission to the beginning of theunblock()method for immediate state updates.Testing
Verified fix using the same testing component from the stackblitz reproducer:
primevue_block_ui_pr_fix.mp4