fix(model-dropdown): rotate the chevron when the menu opens - #1393
Merged
Merged
Conversation
The (opened)/(closed) bindings sat on the cdkMenu panel. CdkMenu has no opened output, so Angular bound a plain DOM listener that never fired: the open flag never became true and the trigger's chevron never rotated. Move both handlers to the trigger as (cdkMenuOpened)/(cdkMenuClosed), the CdkMenuTrigger outputs, and hold the open state in a signal. Specs cover the chevron rotating on open and resetting on close, both from a second trigger click and from choosing a model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
The model picker's chevron never rotated when its menu opened. The
(opened)and(closed)bindings sat on thecdkMenupanel, butCdkMenuonly has aclosedoutput. Angular treated(opened)as a plain DOM event listener that never fires, soonMenuOpened()never ran and[class.rotate-180]="isMenuOpen()"stayed false.Fix
(cdkMenuOpened)/(cdkMenuClosed), theCdkMenuTriggeroutputs (outputs: ['opened: cdkMenuOpened', 'closed: cdkMenuClosed']in@angular/cdk/fesm2022/menu.mjs). This matches the notification bell's menu.cdkMenupanel.Tests
Two new specs in
model-dropdown.component.spec.ts:rotate-180after clicking the trigger and loses it after a second click closes the menu.Both specs fail against the old panel bindings and pass with the fix. The full dropdown spec file passes (16 tests):
🤖 Generated with Claude Code