Skip to content

[Feat]: Override role attribute on sp-divider component #5435

Open
@jwicksnin

Description

@jwicksnin

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

sp-divider

Description of the requested feature

I'm using an sp-divider component as a child of a list. For accessibility, its role should be role="listitem":
<sp-divider vertical role="listitem"></sp-divider>

When rendered in the DOM, however, the role is overriden to role="separator" using setAttribute on firstUpdated by SWC.
<sp-divider vertical role="separator"></sp-divider>

Ideally, we could set role when declaring the component and it wouldn't be overridden on render.

"@spectrum-web-components/divider": "0.44.0"

Mockups or screenshots

No response

Implementation notes or ideas

For reference, here's how it's used:

<firefly-tags data-testid="tags-bar" dir="ltr" role="list" aria-label="Tags">
  <sp-tag class="clear-button" data-testid="clear-button" dir="ltr" role="listitem" tabindex="0">
    <span>Clear</span>
  </sp-tag>
  <sp-divider vertical="" dir="ltr" role="separator" aria-orientation="vertical"></sp-divider>
  <sp-tag tabindex="-1" deletable="" dir="ltr" role="listitem">
    <div class="image-holder" slot="icon">
      <img alt="" src="blob:https://firefly-stage.corp.adobe.com/5396ce76-9280-4424-a928-a7f2256e87c9" style="width:20px;height:20px;object-fit:cover;">
    </div>
   Composition reference
  </sp-tag>
</firefly-tags>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions