-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Description
Problem Statement
<input type="search">
is a long-baseline, standardized input type (since 2016) and widely implemented across browsers. However, the embedded clear/cancel (“X”) button and related decorations cannot be styled consistently across browsers:
- Chromium/WebKit, Safari expose non-standard pseudo-elements like
::-webkit-search-cancel-button
. - Firefox offers no pseudo-element.
- No standardized pseudo-element exists for authors to reliably style the clear button.
This forces developers to either:
- Rebuild their own clear buttons using custom markup and JavaScript, losing native accessibility/semantics.
- Rely on non-standard
::-webkit-
prefixed selectors, which are unsupported elsewhere.
The situation mirrors the past problem with <input type="file">
, which was resolved by introducing ::file-selector-button
as a cross-browser pseudo-element.
Rationale
Evidence of Developer Pain
- Stack Overflow: Editing input type=search pseudo element button (X) — common developer frustration.
- Stack Overflow: Cancel button not showing in Firefox.
- FreeCodeCamp: Targeting the clear button in input fields.
- Blog posts: Remove the “X” in IE/Chrome.
These demonstrate both inconsistent behavior and developer workarounds across ecosystems.
Investigation Roadmap
Standards Status
- HTML spec:
input type=search
. - No standardized pseudo-element for the cancel/clear button.
- Analogous precedent:
::file-selector-button
, standardized and interoperable across all major engines after years of::-webkit-file-upload-button
fragmentation.
Testing Plan
Current WPT coverage for <input type="search">
is limited (wpt.fyi results), focusing mainly on input behavior. To ensure robust interoperability, I propose:
- Pseudo-element coverage tests verifying presence, styling, and inheritance of the clear button.
- Cross-browser styling checks for background, border, size, display, and visibility.
- Interaction tests confirming consistent click/tap behavior while styled.
- Accessibility tests ensuring styling does not break accessible name/role.
- Fallback tests validating correct spec behavior when unsupported.
This approach follows the successful testing roadmap for ::file-selector-button
, giving browsers a credible, clear path to alignment.
Benefits
- Interoperability: Removes reliance on non-standard WebKit pseudo-elements.
- Developer Experience: No more hacks with manual overlays or sniffing.
- Accessibility: Retain native semantics of the clear button while allowing styling, instead of inaccessible custom implementations.
- Consistency: Aligns with precedent set by
::file-selector-button
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status