joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.69k stars 3.63k forks source link

[5.0] Schemaorg plugins broken accessibility #41228

Open brianteeman opened 11 months ago

brianteeman commented 11 months ago

Steps to reproduce the issue

With the new plugins installed and enabled open an article, select a schema and check the html

Expected result

Valid markup with no accessibility errors

Actual result

Example from Bookposting

image

Label for non existing input image

But it shouldnt be a label anyway The fields in the subform-wrapper must be a fieldset with a legend as the first entry in the fieldset instead of the orphaned label above.

System information (as much as possible)

Additional comments

bembelimen commented 11 months ago

Is this schemaorg specific or a global bug in Joomla when using subforms?

brianteeman commented 11 months ago

It's just bad markup in the xml

brianteeman commented 11 months ago

basicaly these are fieldsets not subforms

brianteeman commented 11 months ago

Just rechecked and rechecked. The problem is 100% due to the schema plugin xml. There is no other xml form defintion in Joomla that has "nested" <form> elements. In fact nested forms are very specifically mentioned

Warning: It's strictly forbidden to nest a form inside another form. Nesting can cause forms to behave unpredictably, so it is a bad idea source MDN

(just because we call something a subform doesnt mean that it is)

image

brianteeman commented 10 months ago

If they would just render as a fieldset then it would be fine. but no matter what I have tried it doesnt render as a fieldset. I must be missing somethign obvious

Fedik commented 10 months ago

This layout renders a "non multiple" subform: layouts/joomla/form/field/subform/default.php

brianteeman commented 10 months ago

yes i see that - which is wrong afaict and it should be a fieldset with a legend - see image above - but whenever I try to add it as a fieldest it doesnt render correctly. I must be missing something

Fedik commented 10 months ago

The legend will not show up as you expected. It can be only within that layout.

On your screenshot it is a field label, that rendered in label layout.

In result can be:

<label></label> => from field label

<fieldset>            |
   <legend></legend>  | => from field input
</fieldset>           |
brianteeman commented 10 months ago

that is what is wrong and breaks accessibility and html standards

Fedik commented 10 months ago

Following will not work?

<label for="blabla-input"></label> 

<fieldset id="blabla-input">            
   <legend aria-hidden></legend> 
</fieldset> 

If I right remember we use the same for checboxes/radio field fieldset.

brianteeman commented 10 months ago

Yes thats one option. The "difference" is that for checkboxes/radio we are creating a fieldset out of a single field. In this case we should be rendering a fieldest containing several fields

Fedik commented 10 months ago

In theory it should be possible to do oposite: the label is hidden with hiddenLabel="true" in xml, and the legend visible.

brianteeman commented 10 months ago

it shouldnt be necessary. we already render multiple fieldsets elsewhere

brianteeman commented 10 months ago

https://accessibility.blog.gov.uk/2016/07/22/using-the-fieldset-and-legend-elements/