-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Specification and implementation of <search> element with form functionality #7323
Comments
You've already made your case in the other issue, and others have addressed it point by point. As such I'll close this as it's duplicative. |
<search>
element an alias for <form>
when the action
attribute is specified
This is objectively false.
I've worked more than a week on this proposal. Immediately closing this issue without allowing implementers to think about it undermines my work and trumps the WHATWG's principle of openness. It is a way to suppress a viewpoint that you've strongly disagreed with, as such also a violation of the code of conduct: "... oppressive, or exclusionary remarks, are not allowed." To remedy this harm please reopen the issue and delete your comment, in which case I'll delete mine too. |
@Kaleidea (yes, developer). Though I did appreciate the API surface you proposed and would have found it intuitive, anything I know about search role patterns I learned in or because of that thread! My opinions should be weighed accordingly :) |
Thank you @bathos for the clarification :-) I'm working hard to get in contact with implementers from the 3 browsers. It's hard 😆 |
@Kaleidea just to clarify, I am not an editor of the HTML Living Standard. |
Thank you, @scottaohara. What's the word for your role in writing the examples and explanation for the current topic? |
I should prob add some more clarification, v candidly: The opinion I expressed was sincere: were it up to me (and based only on my current, perhaps very limited) understanding, the API surface you proposed is what I'd prefer. But my motivation for sharing was not to encourage that approach - it was more to maybe wind down the convo. I was getting a strong sense that the pattern of consecutive, long comments arguing an "opposition" angle were breaching norms for constructive collaborative convo. I am certain that you did not intend that at all - the posts are written excellently and it seems you just feel strongly about the case you're making and its merit. Even so, cadence alone can lead to dominating a conversation, and I figured seeing that there were actually other folks (at least one) who saw value in what you were describing might help make it clear that you were being heard (...and didn't need to repeat it again, at least not immediately :). |
Thank you for your honest feedback. I indeed chose the wrong approach, but that became apparent only afterward. https://kaleidea.github.io/whatwg-search-proposal/ is a more consumable presentation, I hope. |
This is the proposed specification and implementation of the
search
element following the best practice usage (MDN, WAI-ARIA), as requested by developers. It covers both usage patterns: server-side and client-side rendering of the search results.Contents
Subpages
<div>
functionalitySpecification changes
<search>
element to tag listsMotivation
The
<search>
element withform
functionality issearch
element represents a part of a document or application that contains a set of form controls or other content related to performing a search or filtering operation." A set of form controls is a form.This approach meets developers' expectations, guaranteeing the best API ergonomy. In the long term this will reduce the learning curve, increase developer satisfaction, make accessibility more intuitive and consequently improve the quality of the World Wide Web. These long-term benefits are worth the little extra effort up front, which is mostly a systematic, trivial rewording of the "Forms" section in the HTML specification to refer to "form" instead of "form element".
Feature definition
<div role=search>
is shortened to<search>
, form submission is disabled<form role=search action="...">
is shortened to<search action="...">
In the first case (
div
) form submission is an unwanted feature, therefore disabled. The second case behaves equivalently to aform
withrole=search
.The
action
attribute's presence distinguishes between the two cases. Aform
without theaction
attribute is migrated to<search action="">
, this slightly alters the specification of theaction
attribute on thesearch
element.Alternatives considered:
method=none
/nosubmit
boolean attribute. To support the migration of thediv
usage without adding extra attributes the absence ofaction
must disable form submission, therefore the alternatives would be redundant.Other form functionality is opt-in, if the developer makes no use of it then it does not change the application's behavior:
<input type=searchbox>
even without a form.<search>
indocument.forms
has no effect on behavior.Nesting of
<search>
and<form>
is invalid in any combination:<search><search>
is semantically meaningless.<div role=search>...<form>
and<form>...<div role=search>
can often be refactored to a single<search>
. Researching usage patterns in the wild suggests this to be possible in most cases.Use-cases
The most common use-case for a
<search>
element is site search. The best practice for implementation is<form role="search" action="/search">
. Exception to this is client-side rendered search results (use-cases without page navigation). In that case a site search page (also advertised in sitesearch.xml) can be used as a no-JS fallback. JS execution cannot be taken for granted, therefore a fallback improves availability in case of unreliable internet or disabled JS.Requests for this feature
<form role="search">
gives you significant functionality beyond the ARIA semantics."<search>
element be an extension of the<form>
element such that it can process its own form actions without having to also be wrapped in a<form>
?"role="search"
to the<form>
element rather than a separate element?"<search>
without<form>
"Prior art
This proposal builds upon the request for the
<search>
element implementing<div role=search>
. The decisions made there that don't affect form functionality also apply here:search { display: block }
in the user agent stylesheetSubpages
Due to length these are split:
<div>
functionalityThe text was updated successfully, but these errors were encountered: