- Notifications
You must be signed in to change notification settings - Fork3.1k
Add the <search> element#7320
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
KittyGiraudel commentedNov 9, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hiiii! ✨ That’s pretty neat—I had no idea this was in the work. I have a couple questions/comments if that’s okay?
I guess where I’m coming at is that if it isnot unique per page (unlike Unless I’m missing something? :) |
scottaohara commentedNov 9, 2021
thanks for the comment,@KittyGiraudel. There is definitely guidance that can be added to flesh that out some more. to quickly answer your questions though:
|
domenic commentedNov 9, 2021
I do think the comparison with IIUC, for both Not sure where that leaves us... |
scottaohara commentedNov 9, 2021
have some additional content to add. my initial PR got messed up though, so will give it a shot again later. |
Kaleidea left a comment• edited by domenic
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by domenic
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(edited by@domenic) Off-topic: see discussion in#5811 (comment)
I'd like to thank the editors' work on this proposal and their long-term service towards the web developer community. However, [there is a viable alternative](https://github.com//issues/7323) with improved API ergonomy that better serves developer needs, but wasn't considered.In my opinion ignoring that alternative would be a missed opportunity to improve developer satisfaction and the quality of the World Wide Web.Opposition
Since this is a low priority feature, there is no need to rush to a solution without giving due consideration for all needs and use-cases, thereforeI have to oppose this proposal in this form at this time. Due to discourtesy and therejection to discuss the alternative of aliasing<form>, I'veappealed the decisions to the Steering Group. I hope their guidance will help achieve an outcome that serves more developers' needs.
Uh oh!
There was an error while loading.Please reload this page.
zcorpan commentedNov 15, 2021
cc @whatwg/html-parser for
Is it OK for new "block" elements to not close If it is, maybe we need to reconsider if |
artalar commentedNov 18, 2021
It would be nice to have |
Kaleidea commentedNov 25, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@artalar I think that would be a separate proposal to hook and redirect the browser's |
Kaleidea commentedNov 25, 2021
@zcorpan Adding the element requires 2 changes to the WebKit & Blink parsers in the HTMLTreeBuilder class: Making it a paragraph closing element requires 2 more trivial changes: OTOH if Note: I don't like the optional |
zcorpan commentedNov 25, 2021
I agree, and it will be a persistent footgun. I think it's probably better in the long run to change the parser when adding a new block element. |
domenic commentedJan 25, 2022
@hsivonen any updates on your thoughts about whether it's OK to have |
hsivonen commentedFeb 4, 2022
If a |
zcorpan commentedMar 23, 2023
|
zcorpan commentedMar 23, 2023
OK I think this is ready now, modulo review of the rendering tests. |
annevk commentedMar 23, 2023
I suggest we let@domenic do the honors since it's been well over a year since we started all this and he might well have some other relevant insights. |
domenic commentedMar 24, 2023
Thank you all for helping push this over the finish line!! I think it's ready to merge. I'll also file an MDN bug. |
Related-to:whatwg/html#7320.Realted-to:whatwg/html#5811.
Related-to:whatwg/html#7320.Realted-to:whatwg/html#5811.
…ment, a=testonlyAutomatic update from web-platform-testsAdd rendering tests for the <search> elementSeewhatwg/html#7320--wpt-commits: c49cf0a72fd7278b6f6da0fd19ed37a3d9262becwpt-pr: 39163
https://bugs.webkit.org/show_bug.cgi?id=254327rdar://107175819Reviewed by Tim Nguyen.Adds the new HTML search element as specified inwhatwg/html#7320. Given the code changes areminimal there is no preferences guard.It doesn't address the unicode-bidi rendering requirements as they arenot addressed for many elements in WebKit:https://bugs.webkit.org/show_bug.cgi?id=256829This change also syncs most of WPT html/syntax/parsing and addsaccessibility test coverage for the main element.* LayoutTests/accessibility/roles-exposed.html:* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/search-styles-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/search-styles-iso-8859-8-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/search-styles-iso-8859-8.html: Added.* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/search-styles.html: Added.* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/flow-content-0/w3c-import.log:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/Element.getElementsByTagName-foreign-02.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/README:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html-integration-point.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_template-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_template.html: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_webkit02-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_webkit02.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_search-element.html: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_search-element_run_type=uri-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_search-element_run_type=write-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_search-element_run_type=write_single-expected.txt: Added.* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tables01.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tables01_run_type=uri-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tables01_run_type=write-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tables01_run_type=write_single-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template_run_type=uri-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template_run_type=write-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_template_run_type=write_single-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests20.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests20_run_type=uri-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests20_run_type=write-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests20_run_type=write_single-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit01.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit01_run_type=uri-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit01_run_type=write-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit01_run_type=write_single-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit02.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit02_run_type=uri-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit02_run_type=write-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_webkit02_run_type=write_single-expected.txt:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/math-parse03.html:* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/test.js:(test_fragment):(convert_innerHTML):* LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/w3c-import.log:* LayoutTests/inspector/css/shadow-scoped-style-expected.txt:* LayoutTests/platform/mac-wk1/accessibility/roles-exposed-expected.txt:* LayoutTests/platform/mac-wk2/accessibility/roles-exposed-expected.txt:* LayoutTests/tests-options.json:* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):* Source/WebCore/css/html.css:(address, article, aside, div, footer, header, hgroup, main, nav, search, section):(address, article, aside, div, footer, header, hgroup, main, nav, section): Deleted.* Source/WebCore/html/HTMLTagNames.in:* Source/WebCore/html/parser/HTMLTreeBuilder.cpp:(WebCore::HTMLTreeBuilder::processStartTagForInBody):(WebCore::HTMLTreeBuilder::processEndTagForInBody):Canonical link:https://commits.webkit.org/264110@main
This was added to the HTML spec here:whatwg/html#7320I mostly based on this on the webkit patch:WebKit/WebKit#13887Bug: 1294294Change-Id: Ia34836f7e5172d862a3a1f24f1e5cbcbb10e6a55Reviewed-on:https://chromium-review.googlesource.com/c/chromium/src/+/4767222Reviewed-by: Mason Freed <masonf@chromium.org>Commit-Queue: Joey Arhar <jarhar@chromium.org>Cr-Commit-Position: refs/heads/main@{#1184358}
pass 2 more tests from html5lib-testswhatwg/html#7320sparklemotion/nokogiri@1c74c8f
…ment, a=testonlyAutomatic update from web-platform-testsAdd rendering tests for the <search> elementSeewhatwg/html#7320--wpt-commits: c49cf0a72fd7278b6f6da0fd19ed37a3d9262becwpt-pr: 39163
Uh oh!
There was an error while loading.Please reload this page.
Closes#5811.
Mini-explainer
This new element allows authors to express the semantics of "a set of form controls or other content related to performing a search or filtering operation".
This is an especially desired semantic because it is something that an ARIA landmark role exists for (
role="search"), but today can only be expressed with ARIA. Adding a dedicated element allows authors to follow thefirst rule of ARIA (~ "don't use ARIA if you can avoid it") and is part of theco-evolution process between ARIA and HTML.Please seethe pull request preview for web-developer focused details on usage and examples.
Some notable design choices:
The name. We were initially a bit concerned that developers would think that this was a type of search input, not a search container. Although we briefly discussed alternative names to combat this like
<searcharea>,<searchform>,<searchgroup>,<searchset>, they each had problems, and a quickTwitter poll helped seal the deal that developers would expect and prefer the name<search>. (In addition to other developers chiming in with reasoning on the thread.) See the comments starting atConsider creating an HTML search element #5811 (comment) for more details.Like other "block-level" elements,
<search>closes any open<p>tags. This ensures an easy transition path from<div role="search">to<search>and maintains platform consistency.Like other "block-level" elements, the user-agent stylesheet for
<search>makes itdisplay: blockandunicode-bidi: isolate.For conformance-checker purposes, the element is categorized as flow content and palpable content, but not sectioning content. (In this respect, it is categorized similarly to
<main>, but not like<nav>or<aside>.) We are not sure whether this is ideal, partly because due toSuggest adding a warning about outline algorithm #83 sectioning content is a tricky category. But we believe that the main effect of sectioning content is to encourage authors to add headings inside the sections, which is perhaps not the right default here?This element is a straightforward replacement for
<div role="search">, and does not come with any additional functionality (such as having form-submission capabilities). Instead it can be combined with other primitives such as<form>, or JavaScript, etc. You can see extensive discussion of this inConsider creating an HTML search element #5811. The reasons for disfavoring more complex solutions areimplementer-expressed considerations about complexity and compat risk, as well asweb-developer and accessibility community preferences.Credits
The element description and examples is almost entirely written by@scottaohara, although I made a few edits and rearrangements.
PR merge checklist
(SeeWHATWG Working Mode: Changes for more details.)
/dom.html (diff )
/grouping-content.html (diff )
/index.html (diff )
/indices.html (diff )
/parsing.html (diff )
/rendering.html (diff )
/syntax.html (diff )