AlaskaAirlines / auro-menu

Custom element that provides a list of options for the user to choose from
https://auro.alaskaair.com/components/auro/menu
Apache License 2.0
2 stars 3 forks source link

resetOptionsStates() throws an error #160

Closed jordanchang closed 2 years ago

jordanchang commented 2 years ago

Describe the bug

As a developer, I want to allow our users to clear all options in an auro-menu. Per the doc, there is a method called resetOptionsStates(), but I couldn't get it to work.

To Reproduce

Steps to reproduce the behavior:

  1. Create an auro-menu with a few options
  2. Via javascript, call resetOptionsStates()
  3. A error is thrown

Expected behavior

Should clear all options

Screenshots

MicrosoftTeams-image (2)

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

I'm basically looking for guidance on how to clear all options.

blackfalcon commented 2 years ago

@jordanjones243 can you take a look at this?

jordanjones243 commented 2 years ago

@jordanchang I have investigated this issue within the code of auro-menu. I tested the resetOptionsStates() function and it seems to be working as expected.

The this.items is undefined error being thrown is due to the fact that this.items is initialized with all existing auro-menuoption elements, which makes me believe it could have something to do with your implementation.

jordanjones243 commented 2 years ago

After further investigation, this error was being thrown because the resetOptionsStates() was being called on this.items when there was no menu options in an auro-menu.

This issue will be closed and a new issue will be opened to reference the root bug: