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

v2: Explicitly specifying the implicit role of a fieldset element changes the styling #430

Open
willclarktech opened this issue Jan 19, 2024 · 7 comments
Labels

Comments

@willclarktech
Copy link

Describe the issue

First of all thank you so much for Pico, I love it!

According to the docs:

role="group" is used to stack children horizontally.

The examples there use a fieldset element, but the implicit role of fieldset is already group and a11y complains about a redundant role: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset#technical_summary

This kind of issue might affect other elements too, I haven't checked.

Current Behavior

Explicitly specifying the default role of a fieldset element changes the styling.

Expected Behavior

It should not make a difference to the style whether the role of an element is implicit or explicit. I'm not sure what the best solution is, but maybe the default styling for a fieldset should be the group styling (ie horizontal), and the other styling (ie vertical) can be triggered by setting the role to none or presentation?

Reproduction URL

n/a

Environment

n/a

@lucaslarroche
Copy link
Member

@willclarktech, thanks.
What tool do you use to see some a11y complains?
I can't see any in Chrome or with Visual Studio linting tools.

I would not remove role="group" now to avoid a breaking change.
But eventually we could change the documentation to use a div instead of a fieldset.
Not sure yet.

@willclarktech
Copy link
Author

Hm, I thought it was standard a11y linting, but it seems this is raised by Svelte for VSCode: https://svelte.dev/docs/accessibility-warnings#a11y-no-redundant-roles

To be clear, this isn't a blocker for me. I just thought default roles were worth considering.

@lucaslarroche
Copy link
Member

As role="group" can be used with a div, and we can't ship a breaking change, we should not change anything.
Perhaps the documentation could be improved.

@Maze-fr
Copy link

Maze-fr commented Apr 14, 2024

Hello,

As ARIA selectors are already in Pico, shouldn't we use aria-orientation ?

@sodiboo
Copy link

sodiboo commented Oct 4, 2024

What tool do you use to see some a11y complains?

I've found that the W3C validator also complains about this usage of role. For example, on pico's docs about it the following diagnostic is returned, among others:

Warning

The group role is unnecessary for element fieldset.

It's also worth noting that this isn't really an "accessibility complaint" (am i misunderstanding what "a11y complains" means in prior discussion?). It's unnecessary here because the group role is implicit; specifying it here is supposed to make absolutely no difference whatsoever. Pico has two different ways here to style what is supposed to be two identical elements.

@willclarktech
Copy link
Author

willclarktech commented Oct 16, 2024

@sodiboo Correct, this isn't specifically an accessibility complaint. Svelte's accessibility tooling is just how I came across the general issue that explicitly specifying the implicit role of an element can affect the styling, which indicates that roles are being somewhat abused by the current approach. Sounds like this is a "won't fix" but would love to see it considered if there's ever a v3!

@Maze-fr
Copy link

Maze-fr commented Oct 16, 2024

What about using aria-roledescription="inline" ?
Isn't it the whole purpose of it, to describe how we use a role ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants