• Erik

    (@codekraft)


    Ciao @takayukister,

    i have noticed that in the recent version of cf7 the wrapper for hidden fields has changed and now it is a fieldset tag. May i ask you the reason for this change? (I have not found it in the latest changelogs)

    From what i know (but i can be wrong) it would be more appropriate to use div because using a <fieldset> in this case is technically not appropriate, as it’s meant to group semantically related form controls and their labels, usually with a <legend> to describe the group. Since hidden fields aren’t user-facing controls and don’t require visual or semantic grouping, wrapping them in a <fieldset> is semantically incorrect and potentially problematic for screen readers or other accessibility tools.

    What do you think? If you confirm me that the change is intentional and persistent I will update the code of my plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    The corresponding issue is here: #1636

    I changed the wrapper element to fieldset because I thought fieldset was more appropriate in terms of semantics. A hidden field is a field, so it should be in a fieldset.

    That said, if there were specific problems for users, I’m willing to reconsider it.

    If you confirm me that the change is intentional and persistent I will update the code of my plugin

    Which plugin do you mean? I don’t think you have to follow my decision, though.

    Thread Starter Erik

    (@codekraft)

     I don’t think you have to follow my decision, though.

    With my antispam plugin, I need to locate and manipulate the wrapper of the hidden field using JavaScript. Currently, I’m using a selector like form > div, but this no longer works. That’s why I’m asking whether you are going to change that wrapper or not.

    The issue is on my side — I didn’t implement a resilient enough method to select it — but I thought it was worth mentioning, as mine might not be the only plugin relying on that structure.

    In any case, thank you for clarifying the reason about that change!

    P.S. Yes, a <fieldset> is meant to group related fields, but it should also include a <legend> describing its purpose, and i believe that is not the right way to wrap hidden fields.

    jeromerdlv

    (@jeromerdlv)

    Hi @takayukister,

    I agree with @codekraft, to be useful a fieldset must come with a legend, and is appropriate for visible fields only, i.e. radio inputs in a group, or address fields when there could be an invoice address and a shipping address.

    There’s no need to group hidden fields, and fieldset may cause accessibility issues with some assistive technologies where it could be announced without any content.

    On my side, I have a graphical issue on all my up-to-date sites because fieldset comes with a default border that shows at the top of my forms.

    Could you please reconsider this change?

    Thanks a lot, and have a nice day!

    I’d like to request you reconsider the change too – as @jeromerdlv notes, the change causes an accessibility issue:

    “There’s no need to group hidden fields, and fieldset may cause accessibility issues with some assistive technologies where it could be announced without any content.”

    This update causes sites using CF7 to fail WCAG 2.2AA accessibility compliance. Adding a legend to the fieldset wouldn’t be appropriate either, so can we request that an alternative to a fieldset is implemented?

    Thanks.

    Hi @takayukister,

    I just had a look at the issue #1636, which is about removing the display: none inline style on the hidden fields wrapper. I indeed think that removing that style is OK since hidden fields are not rendered by browsers, nor the thus empty div container.

    But may I insist that hidden fields are, by definition, deprived of semantic, and that a fieldset wrapper makes no sense in that case?

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.