wpaccessibility / settings-api-enhanced

An improved WordPress Settings API with default render callbacks and a new accessible layout.
9 stars 0 forks source link

Consider to make `add_settings_section()` optionally output a fieldset #14

Open afercia opened 7 years ago

afercia commented 7 years ago

There are cases where it would be worth grouping multiple fields within a fieldset element with a legend. Should add_settings_section() optionally output a fieldset with legend?

felixarntz commented 7 years ago

If it is fine to allow fieldsets with another fieldset within (consider a fieldset section which has a radio field inside), I think this is a valuable enhancement.

afercia commented 7 years ago

If it is fine to allow fieldsets with another fieldset within

It is allowed but not recommended for accessibility. https://accessibility.blog.gov.uk/2016/07/22/using-the-fieldset-and-legend-elements/

It is possible to nest one <fieldset> element inside another, but it is not recommended. Screen readers do not automatically indicate the end of the <fieldset> element, so it is impossible for screen reader users to confidently know which fields belong within which fieldset.

felixarntz commented 7 years ago

Not sure whether we should allow that then. I wouldn't like to add complex logic to disallow using fields that require fieldsets (radio for example) in fieldset sections. So it depends on whether we want to open up that possibility and risk accessibility issues, but on the other hand provide more flexibility.

afercia commented 7 years ago

Yep personally I'd prefer more flexibility and rely on devs education to avoid nested fieldsets (some documentation could help too).