[wp-trac] [WordPress Trac] #19579: Make get_search_form() more filterable/extensible

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 16 16:37:30 UTC 2011


#19579: Make get_search_form() more filterable/extensible
-------------------------------------+------------------------------
 Reporter:  chipbennett              |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Template                 |     Version:  3.3
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------------------

Comment (by chipbennett):

 > How about adding an  aria landmark role as a default? (And if that's
 added, then adding an ID to the label (input field ID + '-label') and a
 aria-labelledby attribute to the input field would also increase the
 accessibility potential.)

 > In my themes I use accept-charset='<?php bloginfo( 'charset' ); ?>' for
 the form just to raise the possibility to get UTF-8.
 >
 > And aria-required='true' required for the search field may prevent
 accidental clicks on the submit button.

 Since the `$atts` arrays are extensible/filterable, these can easily be
 added by the Theme developer. I've basically taken the form markup in the
 current version of `get_search_form()`, and replicated it here. The only
 difference is adding `placeholder="search"`, which I now think should be
 removed, and left to Themes/Plugins to filter in.

 > He's talking about the elements, not the attributes. I think I disagree
 though - visual whitespace can be added with CSS, and I'm not aware of any
 accessibility issues with them following right on from each other within
 the markup. Easier for developers to add some margin between the elements,
 than having to filter the output just to trim extra spaces that is being
 suggested to be added.

 > Search for:SearchSearch :)

 Unless I'm missing something, I agree with GaryJ that this is a
 presentational/CSS issue, that should be left up to Themes to determine
 how to implement.

 > Is there not a existing WP function that can take an array of HTML
 attributes name => value and build the string for you?

 Is there? If you find one let me know. That would be ideal to use!

 > Could you use `submit_button()`?

 I suppose I could - though I'd like some more core-dev feedback on that
 before adding it to the patch. I've only ever seen `submit_button()` used
 in the admin, not on the front end.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19579#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list