ConfirmDialog's openDialogCount FIX - #412
Merged
Jagadeeshftw merged 1 commit intoJul 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes a ConfirmDialog lifecycle bug that could leave the module-level confirm-dialog open counter stuck above zero after navigating away from a page while a confirm dialog was still open.
Previously, ConfirmDialog called markConfirmDialogOpen() when open became true, and markConfirmDialogClosed() only when open changed to false. If the component unmounted while still open, markConfirmDialogClosed() was never called. That caused isConfirmDialogOpen() to keep returning true, which made useFocusShortcut("/") permanently skip focusing the search box until a full page reload.
This PR updates the open-state tracking effect so each effect run that marks a dialog as open also returns a cleanup function that marks it closed. This preserves the existing counter-based tracking for multiple dialogs while ensuring the counter is balanced on unmount.
Also adds regression coverage for:
unmounting an open ConfirmDialog without clicking Cancel or Confirm
confirming isConfirmDialogOpen() returns false after that unmount
confirming the / search-focus shortcut works normally again after an open dialog unmounts
Closes:
Checklist
I added a CHANGELOG.md entry under the next ## [x.y.z] section
text
(see the Format note at the top of
CHANGELOG.md), or this PRis docs-only / test-only / internal tooling and doesn't change
user-facing behavior.
Tests added/updated for the change.
Closes #318