[wp-trac] [WordPress Trac] #39441: Improve the Settings API for accessibility and ease of use.

WordPress Trac noreply at wordpress.org
Mon Feb 27 08:35:58 UTC 2017


#39441: Improve the Settings API for accessibility and ease of use.
-------------------------------------+-------------------------------------
 Reporter:  flixos90                 |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Plugins                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  settings-api has-patch   |     Focuses:  accessibility,
  2nd-opinion                        |  administration
-------------------------------------+-------------------------------------

Comment (by flixos90):

 Replying to @afercia (see
 https://wordpress.slack.com/archives/accessibility/p1487614539002584):

 > 1. labels must be required: no label, no field output
 > 2. we do only explicitly associated label ("for" attribute)
 > 3. we don't output stray labels e.g. `echo ' <label>' .
 $field_args['label'] . '</label>';`
 > 4. groups shouldn't have a label for the... group
 > 5. we need CSS classes for the labels (or, better, an option to print a
 screen-reader-text class?)

 1. Are you referring to the `$title` parameter of `add_settings_field()`
 or to the `input_id` / `label_for` arguments of `$args`? Currently the
 `$title` parameter of `add_settings_field()` is already required (which
 makes sense!), and that one is used as label. The `id` attribute is
 automatically populated with the `$id` parameter as well as the `label
 for` attribute is. One can override that behavior by specifying these in
 `$args` and could theoretically remove one of the attributes, but I think
 this possibility should be left in there for some edge-cases - think
 someone wants to use a field callback, but then output the label somewhere
 else: They could currently do so by overriding `label_for` to an empty
 string, but not any more if we disallow empty `label_for`. I think
 providing sane defaults here should be sufficient.
 2. Not sure I understand what you mean here.
 3. I agree. In [attachment:39441.3.diff] that is only the case in the
 checkbox callback, so I'll adjust it there.
 4. I think the code in [attachment:39441.3.diff] does not put a label on a
 group. While in the code it is handled the same way as a regular label, it
 is actually output as a `legend` of a `fieldset` in these group cases
 (which I thought is okay). Correct me if I'm wrong. :)
 5. I'll put that in the next patch as well.

 Just for reference, I'll leave
 https://wordpress.slack.com/archives/accessibility/p1487614972002599 here:
 We need to figure out whether `before` and `after` should be printed
 inside or outside of fieldsets (only applies to fields that have
 `fieldset` set to true).

 For anyone who would like to participate, join today's meeting at 17:00
 UTC in [https://wordpress.slack.com/messages/core/ #core].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39441#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list