Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
labels related to checkboxed should be associated to them. i just came across this when clicking on the "Select all items on this page" label didn't mark the checkbox as selected.
if possible we would need a unique id for the checkbox and set the "for" attribute of the label accordingly.
another option is to put the checkbox inside the label element.
http://www.456bereastreet.com/archive/200711/use_the_label_element_to_ma...
Comment | File | Size | Author |
---|---|---|---|
#10 | views_bulk_operations-table-select-all-id-1468674-10.patch | 637 bytes | dmundra |
#9 | views_bulk_operations-table-select-all-id-1468674-9.patch | 456 bytes | Alex Bukach |
#7 | vbo-label.jpg | 9.02 KB | crutch |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedI'm not actually doing anything special here:
So the question is: why does it fail...
Comment #2
liquidcms CreditAttribution: liquidcms commentedi think somewhat related. i have a grid layout and i get a select all on this page checkbox and a select all on all pages checkbox with an OR between them.
to start with, the view is not set to use paging; so silly to have both checkboxes as they are now technically the same thing; but regardless of that, if there was some wort of id or class assigned to a wrapper around the checkboxes, labels and even the OR, it would be possible in css to hide these.
i looked at a form_alter but not available at that time to alter; looking next at after_submit function; failing that i guess only solution is use JS or to write a patch to add some way that css can simply hide these.
Comment #3
texas-bronius CreditAttribution: texas-bronius commentedIt's a good question, if the above code is producing the Select All (Pages) checkboxes. However, the derivative markup that is on the VBO form I am dealing with appears to a) be from a FAPI #markup element and b) not show when Javascript is disabled. Here's the dpm/kpr out of $form in a
hook_views_bulk_operations_form_alter
:Something else is going on.
Comment #4
texas-bronius CreditAttribution: texas-bronius commentedBut in the meantime, from the desk drawers labeled "Don't work around it like this," you can work around like this:
Rough and tumble, toil and bumble..
Comment #5
madhaze CreditAttribution: madhaze commentedIt seems like all form items should have an id and checkboxes should have a with the for="xxx" (xxx being the inputs id) Due to VBO not using this standard format i'm having issues styling forms to look consistent. I might look to do what is mentioned above as a work around. That or find a js option possibly
Comment #6
j1mb0b CreditAttribution: j1mb0b commentedActually, the form is not being built correctly it should calling drupal_get_form before drupal_render since it's within that function the call is made eventually to:
https://api.drupal.org/api/drupal/includes%21form.inc/function/form_buil... - which is responsible for settings the #id property on the element.
Therefore, the form build could be set outside the theme function as a standalone form function, which allows you to call drupal_render.
Comment #7
crutch CreditAttribution: crutch commentedThere is no way that I can find to make a label effect the checkbox for a views-row.
Comment #8
Alex Bukach CreditAttribution: Alex Bukach commentedWhy cannot it be as easy as this one?
Comment #9
Alex Bukach CreditAttribution: Alex Bukach commentedCorrected paths in the patch.
Comment #10
dmundra@alex-bukach I believe you addition does work but no label is automatically added to the checkbox. I am actually solving a different problem which is that the lack of the label is an accessibility issue. So I think we should combine your solution with
Comment #11
dmundraI created a related issue https://www.drupal.org/project/views_bulk_operations/issues/3388986 that tackles the missing labels. Maybe that should include the unique ID solution from here?