trimox / angular-mdc-web

Angular wrapper for Material Design (Web) Components
https://trimox.github.io/angular-mdc-web
MIT License
518 stars 86 forks source link

Can't deselect an item in the selection group menu #1997

Closed benjaminforras closed 5 years ago

benjaminforras commented 5 years ago

Describe the bug Can't deselect a selected item in the selection group menu.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://trimox.github.io/angular-mdc-web/#/angular-mdc-web/menu-demo/examples
  2. Click on 'Show Selection Group Menu'
  3. Select anything.
  4. Now try to deselect.

Expected behavior To select an item and to deselect it. Also it would be a nice touch if I don't have to reopen the menu every time I check something.

What Angular MDC version are you using? v3.2.0

What browser(s) is this bug affecting?: I only tried with the latest Google Chrome.

trimox commented 5 years ago

@TryHardDood Thanks for reporting this.

Problems seems to be in getSelectedSiblingOfItemAtIndex(index: number); always returning -1. https://github.com/trimox/angular-mdc-web/blob/master/packages/menu/menu.ts#L108

Let ya know..

trimox commented 5 years ago

Got it. PR incoming.

Also it would be a nice touch if I don't have to reopen the menu every time I check something.

I'll have to submit separate PR for surface closing.