adobe / adobe/spectrum-web-components

[Bug]: Removing `selected` attribute from sp-action-group leads to console error

Open
#3,445 2 comments 0 reactions 0 assignees View on GitHub
bug Component:Action group SEV 5
Dominant language
TypeScript
Stars
1.5k
Forks
262
Avg merge
3d 10h
Merged PRs (30d)
68

Description

### Code of conduct

- [X] I agree to follow this project's code of conduct.

### Impacted component(s)

sp-action-group

### Expected behavior

Removing the `selected` attribute from `sp-action-group` should have the same behavior as not setting it in the first place, and default to an empty array. It shouldn't lead to a console error.

### Actual behavior

It looks like there's a logic error in the code such that the initial default value isn't reset in this case though. It does look like ActionGroup.ts is tracking an `_selected` variable, but not resetting it to the default if the selected attribute is removed.

### Screenshots

_No response_

### What browsers are you seeing the problem in?

_No response_

### How can we reproduce this issue?

1. Go to https://opensource.adobe.com/spectrum-web-components/components/action-group/#selected
2. Inspect the example in the debugger
3. Remove the `selected` attribute from the sp-action-group by editing the html in the debugger
4. You'll see a console error.

### Sample code that illustrates the problem

_No response_

### Logs taken while reproducing problem

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading ActionGroup.ts and reproducing the issue through the selected example at the linked documentation page. The work is done when removing the selected attribute resets the component to an empty array and no console error appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.