Skip to content

ConfirmDialog's openDialogCount FIX - #412

Merged
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Mitch5000:ConfirmDialog's-openDialogCount-FIXED
Jul 27, 2026
Merged

ConfirmDialog's openDialogCount FIX#412
Jagadeeshftw merged 1 commit into
AnchorNet-Org:mainfrom
Mitch5000:ConfirmDialog's-openDialogCount-FIXED

Conversation

@Mitch5000

Copy link
Copy Markdown
Contributor

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 PR

is docs-only / test-only / internal tooling and doesn't change

user-facing behavior.
Tests added/updated for the change.

Closes #318

@Jagadeeshftw
Jagadeeshftw merged commit 785b3ee into AnchorNet-Org:main Jul 27, 2026
1 check failed
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.

ConfirmDialog's openDialogCount leaks permanently open if the dialog unmounts while open, breaking the "/" shortcut app-wide

2 participants