WordPress.org

Ready to get started?Download WordPress

Forums

Search widget does not validate (XHTML/W3C) (8 posts)

  1. raffaz
    Member
    Posted 5 years ago #

    hello,
    if you use the Search widget, you'll find out that the page won't validate in XHTML.
    the culprit is: role="search"
    I deleted it from general-template.php and everything seems to work smoothly, the search appears to work OK and the page now validates.
    I hope this is useful and that it will be fixed, please tell me if I screwed up something instead. :)

  2. Eric Mann
    Member
    Posted 5 years ago #

    I found this issue as well, thanks for letting me know which core file to tweak to fix it. I did some more research, though, and it looks like "role" will be a valid attribute in XHTML 2. Since we can't even validate XHTML 2 yet, though, I'm wondering if there's a better way to fix this in the short run ...

  3. raffaz
    Member
    Posted 5 years ago #

    nice find! maybe the WP team could comment-out "role" or sorting something out while we wait for XHTML 2 (for a long time, I assume).
    I'd also like to know what is the purpose of the role="search" string, because as I said it seems everything is working just fine without it.

  4. demetris
    Member
    Posted 5 years ago #

  5. Eric Mann
    Member
    Posted 5 years ago #

    Demetris, that's just fine for accessibility, but it's not valid markup at the moment. With clients who demand validated website scripts it makes it very difficult to "sell" WordPress as a long-term CMS solution. If roles remain in core, then the automatic update feature will un-do any hardcode editing we do to force WP to validate.

  6. demetris
    Member
    Posted 5 years ago #

    @ericmann:

    Yes, I know. :-)

    It’s also a known issue at the development tracker, and there is also an open ticket against the current branch (2.8).

    It seems that, for now, the only solution is not to use the default search widget or the get_search_form() function, which—when there is no searchform.php template in the active theme’s directory—generates the accessible but invalid code.

  7. kennethjaysone
    Member
    Posted 4 years ago #

    Will i screw anything up if i remove the role attribute in the general-template.php file under the get_search_form() function?

  8. dwj
    Member
    Posted 4 years ago #

    Hi,

    maybe i'm a bit late in reply, but i've target the validation issue in a cleaner way than editing the core file by simply adding a filter to my function.php file.
    Here are details.

    Hope this can be usefull.
    bye!

Topic Closed

This topic has been closed to new replies.

About this Topic