WordPress.org

Forums

Contact Form 7
Add role attribute (3 posts)

  1. polyfade
    Member
    Posted 1 year ago #

    Although classes can be attached to the form element. http://contactform7.com/faq/can-i-add-id-and-class-attributes-to-a-form-element/

    Is there away to add role? I already tried the following, but none worked:
    html_role="form"
    html="role='form'"
    role="form"

    https://wordpress.org/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    Why do you need to add "form" role to <form> element? Isn't it redundant?

  3. Steve Repsher
    Member
    Posted 2 months ago #

    No, it may seem so but is not. The role defines a WAI-ARIA landmark to screen readers for quicker jumps around a page. Note the attribute can also take on the "search" landmark to distinguish it from a generic form, and does not necessarily need to be within the <form> tag but could also be put in the surrounding <div> tag. All Contact Form 7 forms should have role="form" built-in to be WAI-ARIA compliant, and you might also consider building in support for the aria-label or aria-labelledby attributes for situations where there are multiple forms on a single page since screen readers will announce this to distinguish them.

    See http://www.w3.org/WAI/GL/wiki/Using_ARIA_landmarks_to_identify_regions_of_a_page for reference.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic