Mostly stuff being hidden using CSS display:none; & not using labels for the checkboxes.

This should be a pretty simple fix though as it's probably just a couple lines of code here.

That being said this is a complex UI & I'm glad that work has been done to not make it a completely overwhelming grid of checkboxes. We just need to make it more accessible for everyone.

Here's the output from the WAVE Toolbar.
Screen Shot from the WAVE Toolbar

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mgifford’s picture

Issue tags: +Accessibility

tagging

merlinofchaos’s picture

Can you give an example of checkboxes in tables like this that are done correctly? I'm not actually sure what needs to be done to fix this.

mgifford’s picture

It's not checkboxes, but it's essentially the same issue with select dropdowns here #1963128: Elements ordering group lacks labels

The permissions table checkboxes in Core does this correctly.

The title is either unset or simply not provided so that FAPI can't provide a label (or a title) for the form element.

I was digging into Panelizer to try to find references to this in the code.. It's probably a simple change in both cases. Unfortunately, I couldn't find the references I was looking for.

The hidden elements here are more complicated as there are less examples of this pattern. It's a neat pattern, but one which will have some accessibility challenges with it.

merlinofchaos’s picture

Ahh okay.

This UI is somewhat abstracted so it can support most any entity with a plugin. You'll find it in PanelizerEntityDefault::settings_form which is in plugins/entity

mgifford’s picture

Status: Active » Needs review
FileSize
637 bytes

I think this catches the checkboxes..

Where all all the invisible checkboxes being controlled? Must be all in a JS file somewhere, but can't see where.

merlinofchaos’s picture

They're using Drupal's core #states mechanism which controls their visibility based upon other checkboxes.

This is a good example:

        $form['entities'][$this->entity_type][$bundle][$view_mode]['default'] = array(
          '#type' => 'checkbox',
          '#default_value' => !empty($settings['default']),
          '#states' => array(
            'visible' => array(
              $bundle_id . '-status' => array('checked' => TRUE),
              $base_id . '-status' => array('checked' => TRUE),
            ),
          ),
        );
mgifford’s picture

Well, that's very interesting... That's something we'll have to figure out in D8. Don' think that's something that would be easy to back-port.

So, as I understand it,
drupal_process_states() only has two states visible/invisible and invisible uses the CSS display:none; so that it's invisible to everyone.

I believe we need access to a 3rd option, as we do in CSS core/modules/system/system.base.css maybe something like:

.js .js-hide {
  display: none;
}
.js .js-invisible {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  overflow: hidden;
  height: 1px;
}

But that's not something we can address in this issue apparently. Thanks for helping it along though.

EDIT: New issue #1966990: Forms API drupal_process_states() hidden content is not visible to screen readers

mgifford’s picture

Also, my patch in #5 above doesn't fix the problem. Got me closer, but I don't have time to address it just yet.

DamienMcKenna’s picture

Status: Needs review » Needs work
DamienMcKenna’s picture

Issue summary: View changes

adding a note about ui advantages of this process.

DamienMcKenna’s picture

@mgifford: Have you had any time to work on this any further?

DamienMcKenna’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Issue summary: View changes
mgifford’s picture

No, sorry Damien. It's slipped in my priorities.

DamienMcKenna’s picture

micnap’s picture

Status: Needs work » Needs review
FileSize
655 bytes

Followed the example for the label on the permissions page of: Column Name: Row Name.

mgifford had already added the label/row name so I provided the column name....which is hard-coded because the column name is also hard-coded in the table header.

This should complete this ticket as it looks like the hidden checkboxes should be taken care of in #1966990: Forms API drupal_process_states() hidden content is not visible to screen readers.

DamienMcKenna’s picture

Given that #1966990: Forms API drupal_process_states() hidden content is not visible to screen readers is for D8 core, and we're not sure it'll be backported, can more improvements go into Panelizer?

Also, I think it'd be better if the string included a placeholder for the label, e.g. 'Panelize: @label', which I believe would work better for translations.

micnap’s picture

Doh. Let's do this again. Here's another patch.

I'll take a closer look at 1966990 and see what I can do within Panelizer for the hidden checkboxes.

micnap’s picture

Alright, one step closer. I added a new state called 'show' that toggles the element-invisible class instead of the display:none that 'visible' toggles and changed the affected form elements to use the new 'show' state.

Still to do:
Add labels to the invisible form elements.

micnap’s picture

Could have sworn I attached the patch....

micnap’s picture

I've added the labels to the hidden form elements. Needs to be tested on a site that has a bunch of panelizer templates set up to make sure my labels hold out. They should always be labeled: Column name: Entity name, bundle name.

DamienMcKenna’s picture

Status: Needs review » Needs work
FileSize
39.18 KB

Would it make sense to move the new state into CTools instead?

Also, after applying the patch some of the checkboxes disappear:
Where did the checkboxes go?

micnap’s picture

This should fix the missing checkbox issue. Class was getting toggled incorrectly.

Let me know if the state needs to be moved to CTools.

DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

@micnap: Could you please open a CTools issue and see how much could be moved over? Thanks.

DamienMcKenna’s picture

FileSize
6.83 KB

I've split out the new 'show' state handler into a CTools issue: #2493041: Add 'show' state handler for hiding/showing form fields

This patch contains all of micnap's code, just updated to use the CTools functionality.

Status: Needs review » Needs work

The last submitted patch, 24: panelizer-n1963124-24.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review

Silly testbot, a recurring problem reoccurred: #2490864: Testbot problems - ctools fails to download properly

DamienMcKenna’s picture

This appears to work correctly for a regular page load, i.e. there are no more regressions.

DamienMcKenna’s picture

I tested the admin/structure/panelizer page using HTML_CodeSniffer on Safari 8.0.6 on OSX 10.10.3.

Without the patch, WCAG2A:

  • Errors: 180
  • Warnings: 89
  • Notices: 355

Without the patch, WCAG2AA:

  • Errors: 192
  • Warnings: 109
  • Notices: 357

Without the patch, WCAG2AAA:

  • Errors: 200
  • Warnings: 106
  • Notices: 358

With the patch, WCAG2A:

  • Errors: 0
  • Warnings: 89
  • Notices: 355

With the patch, WCAG2AA:

  • Errors: 12
  • Warnings: 155
  • Notices: 357

With the patch, WCAG2AAA:

  • Errors: 66
  • Warnings: 106
  • Notices: 358

This is a tremendous improvement!

FYI all of the WCAG2AAA errors were related to the admin theme - the page title uses a H2 instead of H1, and there's a lack of color contrast on the text links.

The relevant warnings, i.e. ones not related to the admin theme, were:

  • The tables should contain a summary.
  • Select lists should always contain a default value.
  • The "for" attribute of a label should not be used to reference a text link; this refers to the "save to access default panel" and "save to access display list" labels that are generated via '#type' => 'item' - if I change the type to 'markup' the text states logic doesn't work.

All of the notices were related to link 'title' values, etc, i.e. very granular details.

DamienMcKenna’s picture

Title: Nearly 200 Accessibility Errors on 1 Page » Resolve WCAG2 accessibility errors on main settings page
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed! Thank mgifford for getting us started and micnap for great improvements!

DamienMcKenna’s picture

FYI I've created another issue to do a general accessibility review of the entire module: #2493099: [meta] Accessibility review of Panelizer

  • DamienMcKenna committed 1c39a21 on 7.x-3.x authored by micnap
    Issue #1963124 by micnap, mgifford, DamienMcKenna: Resolve WCAG2...
osopolar’s picture

Status: Fixed » Needs work
+++ b/plugins/entity/PanelizerEntityDefault.class.php
@@ -3088,6 +3138,9 @@ abstract class PanelizerEntityDefault implements PanelizerEntityInterface {
     }
+    $form['#attached'] = array(
+      'js' => array(ctools_attach_js('states-show')),
+    );
   }

This adds states-show.js, but there is no such file, resulting in the warning:

file_get_contents(sites/all/modules/contrib/ctools/js/states-show.js): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1488 of /home/dev/websites/example.dev/includes/locale.inc).

Edit: I found it here: #2493041: Add 'show' state handler for hiding/showing form fields. Not sure when the ctools stuff gets committed, until then there might be a check of file exists?

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
452 bytes

Yeah, this is will mean the next release of Panelizer will require v7.x-1.8 or newer.

DamienMcKenna’s picture

(the patch will fail because CTools 1.8 isn't out yet)

rivimey’s picture

It would appear that this patch has been committed to current 3.x-dev branch, which is unfortunate as the corresponding ctools change has not been committed.

http://cgit.drupalcode.org/panelizer/commit/?id=1c39a213eda19ecae24a1b08...

This was discovered because OpenAtrium has just released 2.42 based on panelizer-dev but using latest (i.e. 1.7) ctools :(

DamienMcKenna’s picture

Yeah, I was hoping that japerry would have committed it by now. I'll ping him to see if he'd mind doing so.

DamienMcKenna’s picture

FileSize
452 bytes

The show.js file was finally added to CTools 1.9.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

  • DamienMcKenna committed a3e2fd5 on 7.x-3.x
    Issue #1963124 by DamienMcKenna: Require CTools 1.9 so that it has show....

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.