? Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
15 Jul 2018

The library file libraries\src\Form\Field\CheckboxField.php generates invalid markup by adding a blank label for the checkbox (the code in the component already creates a valid label)

This blank label is a problem for a11y as it is a label for nothing and as it occurs multiple times on the page assistive technology thinks that there also multiple fields with the same label.

As far as I can see this is only used in mass mail users (/administrator/index.php?option=com_users&view=mail) for the bcc fields etc

Testing is easiest by viewing the generated source of the page before and after the patch

avatar brianteeman brianteeman - open - 15 Jul 2018
avatar brianteeman brianteeman - change - 15 Jul 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jul 2018
Category Libraries
avatar brianteeman brianteeman - change - 15 Jul 2018
The description was changed
avatar brianteeman brianteeman - edited - 15 Jul 2018
avatar Quy
Quy - comment - 15 Jul 2018

I have tested this item successfully on df81d55


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21127.

avatar Quy Quy - test_item - 15 Jul 2018 - Tested successfully
avatar laoneo
laoneo - comment - 15 Jul 2018

What do meam with:

the code in the component already creates a valid label

avatar brianteeman
brianteeman - comment - 15 Jul 2018

the valid label is created here

<?php echo $this->form->getLabel('mode'); ?>

avatar Quy
Quy - comment - 15 Jul 2018

Before PR, 2 labels per field:

					<div class="control-group">
						<div class="form-check"><label class="form-check-label"><input type="checkbox" name="jform[recurse]" id="jform_recurse" value="1" class="form-check-input"></label></div>						<label id="jform_recurse-lbl" for="jform_recurse">
	Mail to Child User Groups</label>
					</div>

After PR, 1 label per field.

					<div class="control-group">
						<div class="form-check"><input type="checkbox" name="jform[recurse]" id="jform_recurse" value="1" class="form-check-input"></div>						<label id="jform_recurse-lbl" for="jform_recurse">
	Mail to Child User Groups</label>
					</div>
avatar ggppdk
ggppdk - comment - 15 Jul 2018

@brianteeman
@Quy

that label is there for styling purposes ?
this change will break existing custom styling, is this B/C ?

Can it be done the same way that it is done for multiple checkboxes field ?
which is using a fieldset for the main label and then a label for every individual checkbox

avatar brianteeman
brianteeman - comment - 15 Jul 2018

the markup is wrong - simple as that - any other consideration is irrelevant

avatar ggppdk
ggppdk - comment - 15 Jul 2018

i did not say that existing is correct
i offered an alternative and asked if it is a good one (it is ?),

and the solution i suggested is already use for checkboxes and radio-sets (and other fields ?)

but also please consider this,
if this can be addressed the same way that we are doing for multiple checkboxes field
then it would mean that the multiple checkboxes field markup is bad too ?

and about simple facts:
this change breaks any customized display of the field that depends label

  • either having the label to contain the input
  • or having the label to follow the input
avatar mbabker
mbabker - comment - 15 Jul 2018

that label is there for styling purposes ?

The current markup structure is wrong even by the Bootstrap documentation.

this change will break existing custom styling, is this B/C ?

The current markup structure has already changed in relation to 3.x so the B/C concern is irrelevant.

avatar mbabker
mbabker - comment - 15 Jul 2018

then it would mean that the multiple checkboxes field markup is bad too ?

This is correct. That layout needs updating to render the input outside the label element.

avatar ggppdk
ggppdk - comment - 15 Jul 2018

The current markup structure is wrong even by the Bootstrap documentation.
The current markup structure has already changed in relation to 3.x so the B/C concern is irrelevant.

we posted at same time, yes if course current markup is wrong
but i have made some other points too

  1. can this be solved in a way that it is consistent to solution used for multiple checkboxes and radio-sets fields
  2. even if we ignore B/C it makes custom styling of the input harder

Regarding multiple checkboxes field markup

then it would mean that the multiple checkboxes field markup is bad too ?

This is correct. That layout needs updating to render the input outside the label element

yes, agreed

avatar brianteeman
brianteeman - comment - 15 Jul 2018

even if we ignore B/C it makes custom styling of the input harder

That's just hogwash

avatar ggppdk
ggppdk - comment - 15 Jul 2018

even if we ignore B/C it makes custom styling of the input harder
That's just hogwash

i will not compete in English literature here , i will loose
i would expect that you would ask what i meant with it

you see even if you are thinking of using ::before of ::after pseudo classes , there is a problem ... the checkboxes that will also have labels after the input so you will also need CSS not followed by and possibly CSS :not() for parent container too
thus you will end up doing some somewhat hacky CSS staff

and also if you want to use a ready-made framework it will not work out of the box
but anyway it is possible, i just said it is harder , whatever

What about the point that it is not consistent to solution used for multiple checkboxes and radio-sets fields ?

avatar brianteeman
brianteeman - comment - 15 Jul 2018

hogwash === complete rubbish

your comment on the css is exactly that - i can only assume you are commenting without actually testing

avatar ggppdk
ggppdk - comment - 15 Jul 2018

... you will also need CSS not followed by ...

spoiler, (whatever you call it) there is no such thing to style the previous element on not having an element after it, thus you will need to have a requirement on the CSS class of the parent container in the CSS rules

but the important is not about being difficult or easy but

that it will be ugly and different with CSS for multiple checkboxes and radios
and
any that any ready CSS / JS framework will not work out of the box

avatar brianteeman
brianteeman - comment - 15 Jul 2018

I am not debating it any further - the markup is invalid. invalid markup is wrong.

avatar ggppdk
ggppdk - comment - 15 Jul 2018

we can agree on the last comment
i am not debating this any further either

avatar zwiastunsw zwiastunsw - test_item - 15 Jul 2018 - Tested successfully
avatar zwiastunsw
zwiastunsw - comment - 15 Jul 2018

I have tested this item successfully on df81d55


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21127.

avatar Quy Quy - change - 15 Jul 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 15 Jul 2018

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21127.

avatar wilsonge wilsonge - change - 16 Jul 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-07-16 10:00:48
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 16 Jul 2018
avatar wilsonge wilsonge - merge - 16 Jul 2018
avatar wilsonge
wilsonge - comment - 16 Jul 2018

Thanks guys!

avatar brianteeman
brianteeman - comment - 16 Jul 2018

thank you

Add a Comment

Login with GitHub to post a comment