citizensadvice/cab-ui

Style guide fieldsets and forms

mrdaniellewis opened this issue · 1 comments

In the current styleguide all form controls are wrapped in a <fieldset>. This isn't needed and probably counterproductive as <fieldset> handling in some browsers can be buggy and inconsistent. A <fieldset> is only useful for grouping controls, and really only when there is also a <legend>.

The general advice is to wrap controls in either a <p> or a <div>.

@mrdaniellewis haven't seen examples of buggy handling of fieldset but agree it's over the top and semantically could be better. I've updated the fieldset description in the guide and included a .fieldset class to target when just an individual field is used. This seems to be the best approach and covers both issues. I'll push to gh-pages later today. Thanks.