Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
forms system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
19 Jan 2006 at 02:30 UTC
Updated:
29 Jul 2014 at 17:30 UTC
Jump to comment: Most recent file
This patch moves to using an unordered list of checkboxes or radios since that is a bit more meaningful than a bunch of divs. It removes the extra whitespace. And it puts the input element outside of the label.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drupal_44.patch | 5.45 KB | m3avrck |
| form_0.patch | 5.28 KB | drumm |
Comments
Comment #1
factoryjoe commented+1
Comment #2
ixis.dylan commentedI like it.
Comment #3
m3avrck commentedGreat patch Neil!
I rerolled this patch against HEAD and also added 2 new classes, form-radios and form-checkboxes. That way themers can style these differently (or in most cases, adjust margins/padding, generally on checkboxes).
Also, because of the changes in the patch, the CSS in the above patch was wrong, it still displayed the list-style-type. I corrected the CSS and also corrected the margins so it displays correctly against all major browsers (above patch's CSS created huge margins in IE).
Should be good to go now!
Comment #4
dries commentedNo longer applies. Does this degrate more or less OK in absence of CSS?
Comment #5
m3avrck commentedDries, my above patch still applies cleanly against HEAD.
As for the CSS, yes it degrades very nicely. With CSS disabled, you see a list of checkboxes or radios, appearing almost nearly as identical with CSS turned on.
Comment #6
dries commentedI tried and it looks really weird in absence of CSS.
Comment #7
drummYes, the bullet points are a bit weird. These are lists, so I think it is okay for the small portion of people without CSS.
Comment #8
Crell commentedAny CSS-base design looks like ass without CSS enabled, including drupal.org. :-) The question is whether it is still functional. An unordered list of checkboxes may be ugly, but it's still semantically correct and visually understandable. It's actually more correct than a bunch of divs, I'd argue.
Comment #9
m3avrck commentedI agree with said comments.
In absensce of CSS of you are literrally "turning off style" of course it is not going to look that good :-) But, it is *much* more semantically correct, which to accessibility and screen readers and Google, is *much* more meaningful and much more useful. DIVs are overused, use semenatic content when available.
Still RTC :-)
Comment #10
drummA lot of tables in core misuse form_checkboxes and form_radios to generate individual checkboxes. This generates an
<li>without a<ul>.I think the way to this is to only use single checkboxes and radio buttons in forms. I might get a chance to do this in a separate issue.
Comment #11
drummComment #12
Jaza commentedMoving to 6.x-dev queue.
Comment #13
panchoDoing this without breaking stuff obviously is too tricky to it done get that late in dev cycle. Have to bump it to D7. :(
Comment #14
mgiffordWell, this seems like a good idea. Patch doesn't apply at all well against the CVS at the moment. Wanted to flag this before we get too late in the end of the D7 dev cycle.
Comment #15
mgiffordAdding accessibility tag
Comment #16
mgiffordI do want to give this more thought, but it seems that much of this patch has already been applied.
Main issues are to make lists of radio & checkboxes semantically correct by making sure that they are in an unordered list.
Adding
is probably just something that could be swapped for
(with some modifications of course) in the function theme_radios(). That would be pretty simple I think.
But think it's going to need a serious hack to http://api.drupal.org/api/function/drupal_process_form/7 to allow the list items to be displayed. Really not sure how to pass that it is a list along to the part of the form builder that actually creates the html.
And of course there's:
+ul.form-radios, ul.form-checkboxes {
+ margin: 0.5em 0 0 0;
+ padding: 0;
+ list-style-type: none;
+}
Comment #17
Everett Zufelt commentedI can see the semantic advantage of having a list of radio or checkbox elements marked up as part of a list. I don't believe that this would actually mean any appreciable advantage for users of assistive technology. I also see the problem of theming radio and checkbox elements with an li wrapper if that same element may be displayed in a table cell.
One possible method of working around this would be to only theme radio and checkbox elements as list items if their parent element is radios or checkboxes. We could also possibly create a new property for the radios and checkboxes form element types that will allow form developers to select whether the collection will be themed as a list or not.
Comment #18
mgiffordI'm going to drop the accessibility tag here as Everett didn't see this as a major advantage to assistive tech users.
Also going to point folks to #558928: Form element labeling is inconsistent, inflexible and bad for accessibility as surely if we had more consistent forms we'd have less inconsistent results (like the ones described above).
Comment #19
Everett Zufelt commentedTempted to close this issue, I don't really see the advantage. But, since others have seen the advantage in the past bumping to D8.
Comment #20
Everett Zufelt commentedI have to say that I still don't see a use-case. No comment in 10 months and a 5 year old issue.