[Plugin: Custom Metadata Manager] Checkbox display is confusing, labels should be next to checkbox
-
It took me awhile to realize this wasn’t something in my code. While all the other field types look great with the style you’re using (bold label above, followed by field) and I have read before that vertical stacking is good for usability, I just don’t think it works for the checkbox. Having the checkbox alone on a line with just a heading above it looks totally wrong, and I would be very empathetic to any user who got confused by it. Checkboxes need something next to them. In your example screenshot I think the problem is already visible, but subdued because there is only one checkbox. If you have 4 checkbox fields in a row the issue really starts to sparkle.
In theory having two labels for each checkbox could work, like if the bold heading was “sharing options” and next to the checkbox it said “show sharing tools”, but that is overkill and in this case I think we just need to have checkbox followed directly by the label text already deteremined by the API calls (I managed to mock it up and it looks good).
I looked at the code in
_display_metadata_field()
and I can see why you chose to leave the checkbox on its own line. Having one layout to rule them all is very convenient and the way the code currently flows implies deeply that even though the checkbox looks crazy right now, it’s the way it is supposed to be. That said, I think you should reconsider and find a way to put the checkbox and it’s label on the same line for the sake of usability.The essential change needed is to have the label come after the checkbox. If you do that, then you just have to make the label and divs inside the label
display:inline-block
to have it look and flow great. IMHO this UI would be fine alongside the other field types with their labels above them, having inline checkboxes is totally standard throughout the web.I’m not sure what the best way to code this would be though. The easiest choice would be to add a check above the display of the
<label>
tag forif ('checkbox' != $field->field_type)
so that it doesn’t show for checkboxes, then add the label display after the checkbox in theswitch
section for ‘checkbox’ (i.e. duplicating the label display code). Personally that seems hacky but I’m not sure how attached you are to the current layout and it would definitely work and only involve changes to two lines of code.A much more convoluted but also more elegant solution would be to add some kind of “label_position” property to the $field object and use it to trigger before/after placement in
_display_metadata_field()
, thus having two instances of the label display, and only using one for each type of field. Really it would just be for checkboxes at this point (and probably ever, as there aren’t likely to be many more similar additions to web forms in the near future) so I can easily be convinced that it’s not worth it. It also feels like that metadata has nowhere to live, as it doesn’t really belong in the $field object because it’s not about that particuly field but rather a form of meta on the $field->field_type. Sigh.Anyway, let me know if you want a patch for the first solution and I can work it out for you, though I feel like it might be easier for you to do it yourselves as it’s so simple.
Thanks for the great plugin as always! I’ll just use it as-is for now. It will be a fun test to see if any of my users complain, as I haven’t shown them the new version that has this issue yet ??
- The topic ‘[Plugin: Custom Metadata Manager] Checkbox display is confusing, labels should be next to checkbox’ is closed to new replies.