Separator adds a redundant role="separator" to its default <hr>

Open Beginner friendly
#10,894 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Janani-bn is already working on this.

Since Nov 2, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
html, react, typescript

Research direction

Read the Separator implementation and the useSeparator logic it calls, focusing on how the default hr element type is passed through. Reproduce the issue with <Separator />, then verify that the rendered hr has no redundant role while explicitly chosen non-hr elements retain their intended behavior.

Written by the indexing model from the issue text.

Description

Provide a general summary of the issue here

<Separator /> renders <hr role="separator">.

Separator falls back to 'hr' (let Element = elementType || 'hr') but passes the original, undefined elementType to useSeparator, whose if (props.elementType !== 'hr') then adds the role. Passing elementType="hr" explicitly avoids it.

HTML validators flag the redundant role (html-validate no-redundant-role).

🤔 Expected Behavior?

an <hr> without role="separator".

😯 Current Behavior

<hr role="separator">, because Separator passes the original elementType (undefined) to useSeparator, not the 'hr' it renders.

💁 Possible Solution

pass elementType: Element to useSeparator.

🔦 Context
🖥️ Steps to Reproduce

<Separator />

Version

react-aria-components 1.21.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

OS X

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Dominant language
TypeScript
Stars
16k
Forks
1.6k
Avg merge
2d 19h
Merged PRs (30d)
41

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from adobe/react-spectrum

All issues in adobe/react-spectrum

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.