J4 Issue ?
avatar brianteeman
brianteeman
5 Jul 2018

The implementation of the switcher element completely fails accessibility. The label is not associated with the custom element so is ignored by the screen reader.

To make it easier for you this is a video recording using nvda

https://www.youtube.com/watch?v=hpo1qgFLZR0

I thought that the a11y team had tested and approved this

avatar brianteeman brianteeman - open - 5 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 5 Jul 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Jul 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Jul 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Jul 2018
Category Accessibility
avatar brianteeman brianteeman - change - 5 Jul 2018
The description was changed
avatar brianteeman brianteeman - edited - 5 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - edited - 5 Jul 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 5 Jul 2018
Title
[4.;0] Custom Element Switcher [a11y]
[4.0] Custom Element Switcher [a11y]
avatar brianteeman
brianteeman - comment - 5 Jul 2018
avatar C-Lodder
C-Lodder - comment - 6 Jul 2018

They had approved it.

avatar brianteeman
brianteeman - comment - 6 Jul 2018

So they obviously never tested it

avatar C-Lodder
C-Lodder - comment - 6 Jul 2018

If I rightly remember, they tested the live link we provided, then Dimitris and myself wasted a Saturday discussing and rewriting it based on feedback.

avatar brianteeman
brianteeman - comment - 6 Jul 2018

Anyway the past is irrelevant. It is not accessible as it is and can't be used.

avatar brianteeman brianteeman - change - 6 Jul 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 6 Jul 2018
avatar chmst
chmst - comment - 9 Jul 2018

I said already here joomla/40-backend-template#395 that swithers are not userfriendly as they are. In the actual version it seemed to be better - I did not hear the speaker.

The only way for accessible switchers in my opinion this https://codepen.io/nickbottomley/pen/uhfmn.
Labels for the state on/off must be left and right of the switcher.
If this is not possible, then we better use Checkboxes or lists or simple radio buttons instead of swithers.


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

avatar brianteeman
brianteeman - comment - 9 Jul 2018

Labels for the state on/off must be left and right of the switcher.

What is the reasoning for this?

avatar zwiastunsw
zwiastunsw - comment - 12 Jul 2018

I tested it with a new template. Screen reader: NVDA 2018.2.1. Windows 10. The switch works correctly when you are in focus mode (NVDA + space). If you are in browse mode, the switch does not work.
I also tested with the ChromeVox. It is working properly.

avatar brianteeman
brianteeman - comment - 12 Jul 2018

In all my tests the label is never announced

avatar zwiastunsw
zwiastunsw - comment - 12 Jul 2018
avatar brianteeman
brianteeman - comment - 12 Jul 2018

yes that is exactly what my first video showed. the label is never announced

avatar zwiastunsw
zwiastunsw - comment - 12 Jul 2018

You are right! The label is not announced.

avatar brianteeman
brianteeman - comment - 12 Jul 2018

finally

avatar dgrammatiko
dgrammatiko - comment - 12 Jul 2018

@brianteeman apart the not announced label are there any other problems with this component?

avatar brianteeman
brianteeman - comment - 12 Jul 2018

that was all i checked. read the article I linked to for the solution

avatar ciar4n
ciar4n - comment - 12 Jul 2018

What markup would be considered a11y?

The current switcher...

<span class="switcher active" tabindex="0" aria-checked="true" role="switch" aria-label="Yes">
	<input id="jform_params_menu_text0" name="jform[params][menu_text]" value="0" tabindex="-1" type="radio">
	<input id="jform_params_menu_text1" name="jform[params][menu_text]" value="1" checked="checked" class="active" tabindex="-1" type="radio">
	<span class="switch"></span>
</span>
avatar brianteeman
brianteeman - comment - 12 Jul 2018

@ciar4n it is not the switcher code itself it is that the label is never announced. read the article I linked to for the solution

avatar dgrammatiko
dgrammatiko - comment - 12 Jul 2018

read the article I linked to for the solution

well that article refers to a single checkbox, clearly what we have here is totally different

avatar brianteeman
brianteeman - comment - 12 Jul 2018

The issue as far as I can tell is that you have
// Aria-label ONLY in the container span!

avatar brianteeman brianteeman - change - 10 Aug 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-08-10 20:51:29
Closed_By brianteeman
avatar brianteeman brianteeman - close - 10 Aug 2018
avatar brianteeman
brianteeman - comment - 2 Apr 2019

Reopening.
The switcher should be a fieldset and the label from the xml used as a legend
The label should be the value eg JNO and JYES
If desired a more verbose aria-label can be added with a value of "label"-"value"

I created a codepen to show it can work (without any js)
https://codepen.io/brianteeman/pen/MRwJqd?

Does this really need to be a custom element?

Obviously the styling would need to be updated to match our styles

avatar brianteeman brianteeman - change - 2 Apr 2019
Status Closed New
Closed_Date 2018-08-10 20:51:29
Closed_By brianteeman
avatar brianteeman brianteeman - reopen - 2 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2019
Status New Discussion
avatar brianteeman
brianteeman - comment - 2 Apr 2019

Sorry @chmst I completely forgot about the codepen that you shared. That also works if you add the fieldset and legend (its prettier than mine as well) https://codepen.io/nickbottomley/pen/uhfmn

avatar zwiastunsw
zwiastunsw - comment - 2 Apr 2019

Does this really need to be a custom element?

Your concept is the right one. It doesn't have to be a custom element. Because as you show, you can do it well without any JavaScript.

avatar dgrammatiko
dgrammatiko - comment - 2 Apr 2019

Does this really need to be a custom element?

It doesn't have to be a custom element.

YES ALL FIELDS NEEDS TO BE CUSTOM ELEMENTS
Here is the reasons:

  • Custom elements are the only scripts that are lazily loaded
  • Custom Elements are the only scripts that serve ES6 code to the newer browsers (>90%)
  • Custom Elements leverage the browsers events so repeated fields work without any more code
  • Custom Elements are modular by nature which is the right way to do it

That said, if a field doesn't have any javascript obviously doesn't have to be a custom element

avatar brianteeman
brianteeman - comment - 2 Apr 2019

If it needed any js that might be true
If they worked that might be true
If anyone understands them and is able to contribute that might be true
There is a reason @wilsonge called a moratorium on them

But all of that is off topic for this switcher

avatar dgrammatiko
dgrammatiko - comment - 2 Apr 2019

Unsubscribed...

avatar wilsonge
wilsonge - comment - 2 Apr 2019

I created a codepen to show it can work (without any js)
https://codepen.io/brianteeman/pen/MRwJqd?

This has a bug (I think) where i had to click on it twice to change the value (first time only gained focus but didn't toggle)

Sorry @chmst I completely forgot about the codepen that you shared. That also works if you add the fieldset and legend (its prettier than mine as well) https://codepen.io/nickbottomley/pen/uhfmn

Agree this is styled a bit nicer

Either way if we can do this without JS (and it works in IE11) then go with it and ditch this custom field

avatar brianteeman
brianteeman - comment - 2 Apr 2019

Going to have a go and see what code I can produce based on @chmst proposal

avatar brianteeman
brianteeman - comment - 2 Apr 2019

the code in the nickbottomley pen works on IE11 according to my test

avatar wilsonge
wilsonge - comment - 3 Apr 2019

Cool. then obviously I approve removing the javascript one in favour of the css based one if we don't need the JS. We obviously want to style it akin to the latest proposals https://coolcat-creations.com/joomla/#/screens/267320995 @coolcat-creations

avatar brianteeman
brianteeman - comment - 3 Apr 2019

For now I will just do some basic styling akin to the current switch

BTW do you know why com_config doesn't use the renderfield layout? I wasted a lot of time until I realised that

avatar wilsonge
wilsonge - comment - 3 Apr 2019

No clue. Feel free to convert if it doesn't break anything. I guess something to do with it being on the old MVC in J3 (although can't point at anything specific)

avatar joomla-cms-bot joomla-cms-bot - change - 3 Apr 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-04-03 13:59:19
Closed_By joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 3 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Apr 2019
Closed_Date 2019-04-03 13:59:19 2019-04-03 13:59:22
Closed_By joomla-cms-bot franz-wohlkoenig
avatar joomla-cms-bot
joomla-cms-bot - comment - 3 Apr 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 3 Apr 2019

closed as having Pull Request #24463

Add a Comment

Login with GitHub to post a comment