pico icon indicating copy to clipboard operation
pico copied to clipboard

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

Open willclarktech opened this issue 1 year ago • 7 comments

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

willclarktech avatar Jan 19 '24 16:01 willclarktech

@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.

lucaslarroche avatar Feb 13 '24 14:02 lucaslarroche

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.

willclarktech avatar Feb 13 '24 15:02 willclarktech

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.

lucaslarroche avatar Feb 18 '24 05:02 lucaslarroche

Hello,

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

Maze-fr avatar Apr 14 '24 15:04 Maze-fr