Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Text> accessibility #154

Open
Jonesus opened this issue Jul 18, 2023 · 0 comments
Open

<Text> accessibility #154

Jonesus opened this issue Jul 18, 2023 · 0 comments
Labels
client Related to the client app only enhancement

Comments

@Jonesus
Copy link
Contributor

Jonesus commented Jul 18, 2023

Background
I often see people using the variant prop of the <Text> component to change the styling of a text element (as it is intended). However, without supplying an as prop, the variant changes the tag the element is rendered as, often having implications in the accessibility of the document. For example, it's easy to use some title3 variant in order to get slightly emphasized text without the element having any semantic significance, but with the current defaults it gets rendered as an <h3> and thus can screw up the heading tree of a page.

Suggestion
Similarly to "no aria is better than bad aria", I feel that we should render all <Text> components as <p> by default. Perhaps have some kind of an opt-in toggle for them to render as semantically significant elements if the tedium of manually specifying as-prop feels too big?

I feel that in an ideal world things would work as they are currently, but I'm not sure what kinds of safeguards could be implemented to guide the users to correct patterns 🤔

Other notes
Is there a reason that variants body, bodySmall, bodyLarge and bodyStrong are rendered as <span> rather than <p>?

@Jonesus Jonesus added enhancement client Related to the client app only labels Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Related to the client app only enhancement
Projects
None yet
Development

No branches or pull requests

1 participant