Skip to content

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

Open
@mscherotter

Description

@mscherotter

Code of conduct

  • 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

<sp-action-group  emphasized id="rotation" selects="single" 
     @change=${this.onChange}>
    <sp-action-button value="1">One</sp-action-button>
    <sp-action-button value="2">Two</sp-action-button>
    <sp-action-button value="3">Three</sp-action-button>
  </sp-action-group>
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions