Comments

mgifford’s picture

Status: Active » Needs review

go bot go.

bleen’s picture

+++ modules/locale/locale.admin.inc	17 Aug 2010 14:00:51 -0000
@@ -550,8 +557,15 @@ function _locale_languages_configure_for
       $table_form['enabled'][$id] = array('#type' => 'checkbox', '#default_value' => $enabled);

maybe I'm misreading the patch, but shouldn't this line be removed?

Powered by Dreditor.

mgifford’s picture

StatusFileSize
new113.38 KB
new51.88 KB
new2.94 KB

@bleen18 - thanks. You're right. Also realized after a few other similar patches that this needs a bit more clean up and a screen shot or two to explain what the labels are that are actually being added.

They are tied to these two pages:
admin/config/regional/language
admin/config/regional/language/configure

ramlev’s picture

Assigned: Unassigned » ramlev
Status: Needs review » Reviewed & tested by the community

All tests good, and code ok

dries’s picture

Wouldn't it be better if we consolidated the 'Enabled' and 'Description' columns in http://drupal.org/files/issues/screen-capture-10_3.png? The reason I'm suggesting this is because the description seems to be much better than the invisible text. I don't have the answer -- just bringing it up as a suggestion. Thoughts?

mgifford’s picture

@Dries that is an interesting idea. I think there are probably a lot of cases where if we simply used the description as the label for the checkbox and presented it in one column it might be clearer. Part of the challenge is in not having the label completely repeat the information provided.

I do think merging them is something we should consider for D8. It may well be better for usability too (reducing a column should make things easier for everyone to understand I expect).

I do think that there does need to be some work looking at how we want to structure this text, even if it is invisible. Do we want it to end with a '.' ? Does it matter if the case isn't correct? It's a checkbox so we're always either enabling or disabling something. Should we start it with "Enable/disable ..." rather than as I have here. Should it be smart enough so that it says "Enable" or "Disable" depending on the checkbox (that would require some jQuery so I'd say this is too complicated for too little value myself)?

I've just been making stuff up in the interim with the previous LABEL issues I've been creating this week.. Largely I've been of the mind that almost anything is an improvement. If it doesn't add confusion to the screen reader user it will help it if we get this into core. However, it will look much more professional if we get this done right & have an understanding documented about how to treat labels (invisible or not) in core forms. Perhaps there is one I'm just not aware of. Any changes that we make to these strings after the release of Drupal 7 can be made without affecting the vast majority of users, so I was pretty confident that we'd be able to work this out without having to slow down the release of core.

In anycase, I think this label would be improved by changing this line:

        '#title' => t('Enable language detection for !title', array('!title' => $provider_name)),

to

        '#title' => t('Enable !title language detection method', array('!title' => strtolower($provider_name))),

That I think would be a better label than the present description boxes as most of the existing description boxes describe what the the method does rather than what the checkbox does. We'd have to work enable in there somewhere.

Should I just re-roll that?

sun’s picture

I think I already tried the idea of using checkboxes in a tabledrag for the new Filter format UI, but that did not work out.

mgifford’s picture

After the discussion here #882688: Label missing in block admin page - I'm wondering if we should be using:

        '#title' => t('Enable @title language detection method', array('@title' => strtolower($provider_name))),

Any thoughts?

bleen’s picture

or...

'#title' => t('Enable @title language detection method', array('@title' => drupal_strtolower($provider_name))),

mgifford’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.99 KB

Interesting.. So yes, I think I'd skipped this function:
http://api.drupal.org/api/function/drupal_strtolower

I've converted it to the '@' approach & cleaned up the language.

It's also now running lower case titles for the language detection.

This is a label for a screen reader which won't differentiate for case in this context I am pretty sure. It's better with lower case here, but don't think it's critical.

We'll need to get this looked at & RTBC'd again.

Everett Zufelt’s picture

Looks good, but I'm not comfortable enough with this module to give an RTBC.

mgifford’s picture

#11: locale_overview_labels_v3.patch queued for re-testing.

Everett Zufelt’s picture

Priority: Normal » Major

Setting to major priority. IMO missing labels, a WCAG 2.0 level A success criteria, is major (if not critical).

bowersox’s picture

Code looks good. I haven't tested it yet.

mgifford’s picture

Issue tags: -Accessibility

#11: locale_overview_labels_v3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, locale_overview_labels_v3.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

#11: locale_overview_labels_v3.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, locale_overview_labels_v3.patch, failed testing.

mgifford’s picture

StatusFileSize
new2.88 KB

Missed that this needed to be updated to keep up with core. Trying again.

mgifford’s picture

Status: Needs work » Needs review

Go bot..

xano’s picture

+++ modules/locale/locale.admin.inc	17 Aug 2010 14:00:51 -0000
@@ -30,6 +30,8 @@ function locale_languages_overview_form(
+      '#title' => t('Weight for @row', array('@row' => $language->name)),

@row is semantically incorrect. Use @language instead.

+++ modules/locale/locale.admin.inc	17 Aug 2010 14:00:51 -0000
@@ -550,8 +557,15 @@ function _locale_languages_configure_for
+        '#title' => t('Enable/Disable language'),

I don't see "Enable/Disable language" anywhere in the screenshots. Where is it being used? Also, checkbox titles tell users what happens if they check the checkbox, not what happens if they dont, so use t('Enable language') or t('Enable @language').

Powered by Dreditor.

mgifford’s picture

Right now it's actually:

+      '#title' => t('Weight for @title', array('@title' => $language->name)),

at least if we're looking at the same patch.

Where is the 'Enable/Disable language' string in the patch above?

I think I'm missing something here but not sure what...

@Xano, can you fill me in?

dalin’s picture

Status: Needs review » Needs work

@mgifford great stuff. No idea what @Xano is talking about. Here's some additional thoughts:

      $title = drupal_render($form['name'][$key]);
      $form['enabled'][$key]['#title'] = t('Enable @title', array('@title' => $title));
      $form['enabled'][$key]['#title_display'] = 'invisible';
      $form['site_default'][$key]['#title'] = t('Set @title as default', array('@title' => $title));
      $form['site_default'][$key]['#title_display'] = 'invisible';
      $rows[] = array(
        'data' => array(
          '<strong>' . $title . '</strong>',

This stuff is not theming, it's form building and so shouldn't be in a theme function. We can't put it into the form builder because the checkboxes and radios aren't expanded yet, but perhaps this should go in a #process step.

Otherwise looks great.

xano’s picture

Status: Closed (duplicate) » Needs work

I think I accidentally reviewed an older patch. My bad!

catch’s picture

Status: Needs work » Closed (duplicate)

#82694: System Information: information about the Drupal installation and system environment fixed this, looks like a straight duplicate to me. If that issue missed one I'd suggest opening a new issue since there's a lot of discussion here which is outdated now that other patch is in.

mgifford’s picture

Status: Needs work » Needs review

I just went here - en/admin/config/regional/language

On a test site & looks like this issue is still there. I haven't done a comprehensive review since I initially posted these errors about missing labels, but I'm sure there are others in D7 that didn't get fixed.

mgifford’s picture

#20: locale_overview_labels_v4.patch queued for re-testing.

Everett Zufelt’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

Applied and tested with 8.x-dev.

sun’s picture

#20: locale_overview_labels_v4.patch queued for re-testing.

sun’s picture

Status: Reviewed & tested by the community » Needs work
+++ modules/locale/locale.admin.inc	26 Nov 2010 19:47:15 -0000
@@ -32,6 +32,8 @@ function locale_languages_overview_form(
       '#title_display' => 'invisible',
...
+      '#title_display' => 'invisible',
+      '#title' => t('Weight for @title', array('@title' => $language->name)),

At minimum, #title_display is duplicated here. Quite possibly, #title is too (out of diff context). In any case, #title should be defined before #title_display.

+++ modules/locale/locale.admin.inc	26 Nov 2010 19:47:15 -0000
@@ -77,9 +79,14 @@ function theme_locale_languages_overview
+      $title = drupal_render($form['name'][$key]);
+      $form['enabled'][$key]['#title'] = t('Enable @title', array('@title' => $title));
...
+      $form['site_default'][$key]['#title'] = t('Set @title as default', array('@title' => $title));

Since drupal_render() is called on the element, I can only guess that the value in $title is already sanitized to be displayed in HTML. Thus, @title would run check_plain() once again on the already sanitized string, potentially leading to double-escaping.

This issue needs to be verified very carefully.

+++ modules/locale/locale.admin.inc	26 Nov 2010 19:47:15 -0000
@@ -568,20 +575,21 @@ function _locale_languages_configure_for
+      $provider_name = check_plain($provider['name']);
...
-        '#title' => t('Weight for @title', array('@title' => $provider['name'])),
+        '#title' => t('Weight for @title language detection method', array('@title' => drupal_strtolower($provider_name))),
...
-      $table_form['title'][$id] = array('#markup' => check_plain($provider['name']));
+      $table_form['title'][$id] = array('#markup' => $provider_name);
...
-        '#title' => t('@title language provider', array('@title' => $provider['name'])),
+        '#title' => t('Enable @title language detection method', array('@title' => drupal_strtolower($provider_name))),

check_plain() already ran on $provider_name, so @title leads to potential double-escaping.

In this case, I'd recommend to leave the manual check_plain()s intact and pass the original $provider['name'] as value for @title instead.

12 days to next Drupal core point release.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB

I went and tried to implement this but really didn't like that the same value was being checked separately 3X if I left in the @.. I changed it to ! which should pass it through unchecked.

Thanks for this great review. For testing we just need to put in titles for that have bad characters in them like &, # & < right?

Definitely don't want to have this string checked more than once.... Thanks for catching this! As usual a great review.

sun’s picture

Status: Needs review » Needs work

Now you've inconsistently changed the t() tokens - the token in the string subject must match the array key in the passed in replacement token array.

+++ b/modules/locale/locale.admin.inc
@@ -80,9 +80,14 @@ function theme_locale_languages_overview_form($variables) {
+      $title = drupal_render($form['name'][$key]);
+      $form['enabled'][$key]['#title'] = t('Enable !title', array('@title' => $title));
+      $form['enabled'][$key]['#title_display'] = 'invisible';
+      $form['site_default'][$key]['#title'] = t('Set @title as default', array('@title' => $title));
+      $form['site_default'][$key]['#title_display'] = 'invisible';

This chunk of code needs an inline comment that explains why the form element properties are manipulated in a theme function instead of already being set in the form constructor.

The reason for doing it in the theme function is that we're theming the form as a table, so the element labels are not visible and do not fit into the table cells. If we wouldn't theme the form as a table, then the regular element labels would be sufficient and perfectly okay. (Obviously, don't copypaste this 1:1, please)

12 days to next Drupal core point release.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new2.35 KB

Sorry, I must have just needed for the coffee to settle in or something. Hopefully this is better.

I don't think this quite cuts it for a description:

      // Accessibility enhancement to ensure table elements are labeled properly but not visible.

But hopefully other folks can chime in with a better way to describe it.

This should also be done elsewhere in the code so perhaps there's text we can copy to ensure that there is a consistent description in the code.

sun’s picture

Status: Needs review » Needs work
+++ b/modules/locale/locale.admin.inc
@@ -80,9 +80,16 @@ function theme_locale_languages_overview_form($variables) {
+      // Accessibility enhancement to ensure table elements are labeled properly but not visible.

Exceeds 80 chars.

Let's change that into:

"Add invisible labels for the checkboxes and radio buttons in the table for accessibility. These changes are only required and valid when the form is themed as a table, so it would be wrong to perform them in the form constructor."

The similar other changes we applied elsewhere in core do not need this explanation, because we applied them to the form constructors. The situation is a bit special here, since such kind of form structure changes normally do not belong into a theme function. We apply them to the theme function, because the form is themed as a table. If some module would override that theming to not output the form as a table, then the form would contain extremely wonky labels for the checkboxes and radio buttons. Hope it's clear now?

12 days to next Drupal core point release.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB

Gets pretty small when it's tabbed in that far, but here it goes. Thanks Sun!

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good to go for me now.

dries’s picture

Version: 8.x-dev » 7.x-dev

Committed to 8.x. Moving to 7.x.

Everett Zufelt’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.52 KB
bowersox’s picture

+1 for this. The code looks good (both what was committed to 8.x and is now proposed for 7.x). The labels will help make this form meaningful.

mgifford’s picture

Status: Needs review » Reviewed & tested by the community

Tested this and can confirm that the d7 version of my d8 RTBC patch works as expected.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

While the hidden form elements are probably okay, since they fix a legitimate accessibility bug and are not user-facing the majority of the time, I don't think we can do these in D7:

-        '#title' => t('Weight for @title', array('@title' => $provider['name'])),
+        '#title' => t('Weight for !title language detection method', array('!title' => drupal_strtolower($provider_name))),

...

-        '#title' => t('@title language provider', array('@title' => $provider['name'])),
+        '#title' => t('Enable !title language detection method', array('!title' => drupal_strtolower($provider_name))),

These would break user-facing (well, admin-facing) strings, and this seems to be a small text clarification, not an actual bug fix.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new1.3 KB

I can see the logic behind that decision. I've just removed the modifications to the _locale_languages_configure_form_language_table() function and think the patch will provide the labels as required for D7. It will be more understandable in D8.

I just deleted the code from the existing patch so this needs to be tested for sure.

sun’s picture

@webchick: The string changes you objected in #42 are not visible anyway...? They are output as 'title' attribute of a checkbox. Only visually impaired users read them.

Everett Zufelt’s picture

Status: Needs review » Reviewed & tested by the community

Applied and tested successfully against 7.x

Everett Zufelt’s picture

@Sun

Just saw your comment. Although I understand that the strings are not visible, and would enhance the UI slightly for screen-reader users, I think that it is a good practice to keep strings aligned. Unless there is a strong reason I don't see the need for a string exception for accessibility as a general rule.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +String freeze

Great, thanks for the re-roll!

Committed to 8.x and 7.x.

Status: Fixed » Closed (fixed)
Issue tags: -String freeze, -Accessibility, -Needs backport to D7

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