adobe / adobe/spectrum-web-components

[Bug]: sp-action-group change event fires before selection change

Open
#5,448 1 comment 0 reactions 0 assignees View on GitHub
bug Component:Action group SEV 3
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

When using a sp-action-group acts as a radio group with the selects="single" attribute, the change event should dispatch after the sp-action-button child is assigned a selected attribute.

### Actual behavior

The change event dispatches before the sp-action-button is given the selected attribute so the changed state is still the previous value.

### Screenshots

_No response_

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

_No response_

### How can we reproduce this issue?

see sample code

### Sample code or abstract reproduction which illustrates the problem

```

One
Two
Three

```

```
onChange(){
const rotation = this.renderRoot.querySelector("#rotation sp-action-button[selected]")?.getAttribute("value");

if (rotation){
console.log(rotation);
}
}
```

### Severity

SEV 3

### Logs taken while reproducing problem

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the sp-action-group implementation and reproduce the sample with selects="single" and the change handler shown. Verify that the child sp-action-button has its selected attribute updated before the change event runs, and confirm the handler reads the newly selected value.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.