Skip to content

fix: close other dropdowns when one is opened - #643

Open
kripa-sindhu-007 wants to merge 1 commit into
argoproj:masterfrom
kripa-sindhu-007:fix/dropdown-close-sibling-dropdowns
Open

kripa-sindhu-007 wants to merge 1 commit into
argoproj:masterfrom
kripa-sindhu-007:fix/dropdown-close-sibling-dropdowns

Conversation

@kripa-sindhu-007

Copy link
Copy Markdown

Opening a DropDown leaves every other open DropDown on the page open. Reported downstream as argoproj/argo-cd#30112, where the four filters in Argo CD's sync operation panel (HEALTH / STATUS / HOOK / MESSAGE) all stack up on top of each other.

Cause

The coordination mechanism already exists here, it just never fires. Every instance subscribes to the module-level dropDownOpened subject and closes itself when a different dropdown is published to it:

dropDownOpened.pipe(filter((dropdown) => dropdown !== this)),

But dropDownOpened.next(...) is never called anywhere in the repo ; open() only sets its own state, so nothing is ever published and no sibling is ever notified.

The document click handler can't cover this case either: the anchor calls event.stopPropagation(), so a click on a sibling anchor never reaches it. Clicking anywhere neutral does close the dropdowns, which is why only sibling anchor clicks were affected.

Fix

One line in open(), publishing the instance that just opened so the existing subscription can do its job.

Verification

  • The added test fails on master (Expected the element not to have class: opened) and passes with the fix.
  • Full suite 70/70, typecheck and eslint clean.
  • Checked in a real Argo CD (v3.5.4, local cluster) by pointing the Argo CD UI dev server at a build of this branch. Clicking the four filters in sequence previously left 1 → 2 → 3 → 4 dropdowns open; with the fix the count stays at 1.

Before / after:

argocd-30112-before argocd-30112-after

Note on #641

#641 fixes a different symptom in this file — clicking an open dropdown's own anchor to close it — by routing the anchor through a new toggle(). This change lands inside open() and doesn't touch the anchor handler, so the two are complementary rather than competing; whichever merges second should apply cleanly. I kept the test helper inline rather than adding a shared one, to avoid colliding with the isOpened helper #641 introduces.

AI assistance

Claude Code was used while investigating and preparing this change. I've verified the behaviour myself against a real Argo CD instance as described above, I understand every line, and I'll be answering review personally.

@kripa-sindhu-007
kripa-sindhu-007 force-pushed the fix/dropdown-close-sibling-dropdowns branch from d1a5928 to 6a9f179 Compare October 11, 2026 12:18

@jsoref jsoref left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems reasonable to me

Every DropDown subscribes to the module-level dropDownOpened subject and
closes itself when a different dropdown is published to it, but open() never
published, so the subscription never fired and opening one dropdown left the
others open.

The document click handler cannot cover this case: the anchor calls
stopPropagation(), so a click on a sibling anchor never reaches it. Clicking
anywhere else still closes the dropdowns, which is why only sibling anchor
clicks were affected.

Signed-off-by: Kripa Sindhu <mail@kripasindhu.dev>
@kripa-sindhu-007
kripa-sindhu-007 force-pushed the fix/dropdown-close-sibling-dropdowns branch from 6a9f179 to bd3edf8 Compare November 21, 2026 05:52
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d428792e-40e6-4563-84a0-9fd0eeae838e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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.

2 participants