Opened 14 years ago
Closed 13 years ago
#16538 closed enhancement (maybelater)
Add placeholder attribute to search field
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description
By default the search widget is just a blank field. This is really unfortunate. However, HTML5 has a solution! Since the search field is already {{type="search"}}, we only need to add the attribute placeholder="Search"
to the element.
<hmtl> … <form action="http://example.com/" method="get" id="searchform-1"> <input type="search" name="s" id="s-1" placeholder="search" /> </form> … </html>
Attachments (1)
Change History (11)
#2
in reply to:
↑ 1
@
14 years ago
Placeholders don't degrade gracefully in browsers, do they?
There is nothing to degrade? Browsers that don't support it (eg IE<9, FF<4) just ignore it.
#4
follow-up:
↓ 5
@
14 years ago
You can change the form with the get_search_form filter. So if you have a theme with HTML5 doctype you can add the new attribute.
In my opinion it's too soon to add HTML5 attributes into the core.
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
14 years ago
Replying to ocean90:
You can change the form with the get_search_form filter. So if you have a theme with HTML5 doctype you can add the new attribute.
In my opinion it's too soon to add HTML5 attributes into the core.
The attribute type="search"
is an HTML5 attribute and is already in core.
#6
in reply to:
↑ 5
;
follow-up:
↓ 8
@
14 years ago
Replying to cyberskull:
The attribute
type="search"
is an HTML5 attribute and is already in core.
No, it's not. Your theme probably has a custom searchform.php.
#7
@
14 years ago
- Cc info@… added
By default the search widget is just a blank field.
That depends on the theme. By default the search field has a label.
If we add a placeholder users with a screenreader and a modern browser have to listen to the label and the placeholder. As long as there is not better text for the placeholder than an illegal label replacement/duplicate no one benefits from the attribute.
#8
in reply to:
↑ 6
@
14 years ago
Replying to nacin:
Replying to cyberskull:
The attribute
type="search"
is an HTML5 attribute and is already in core.
No, it's not. Your theme probably has a custom searchform.php.
My mistake then.
I don't think we are type=search in core. We should, though.
Placeholders don't degrade gracefully in browsers, do they?