Skip to content
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

Make the search block editor match the frontend #30176

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/block-library/src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
@import "./pullquote/editor.scss";
@import "./quote/editor.scss";
@import "./rss/editor.scss";
@import "./search/editor.scss";
@import "./separator/editor.scss";
@import "./shortcode/editor.scss";
@import "./site-logo/editor.scss";
Expand Down
48 changes: 48 additions & 0 deletions packages/block-library/src/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,52 @@
line-height: revert;
font-weight: revert;
}

select,
input,
textarea,
button {
font-family: system-ui;
font-size: revert;
font-weight: revert;
border-radius: revert;
border: revert;
background: revert;
color: revert;
padding: revert;
margin: revert;
line-height: revert;
min-height: revert;
box-shadow: revert;
box-sizing: revert;
}

// For these I prefer to only override the WP-Admin defined styles and not "all"
// To minimize the risk to impact block styles as much as possible.
input[type="checkbox"],
input[type="color"],
input[type="date"],
input[type="datetime-local"],
input[type="datetime"],
input[type="email"],
input[type="month"],
input[type="number"],
input[type="password"],
input[type="radio"],
input[type="search"],
input[type="tel"],
input[type="text"],
input[type="time"],
input[type="url"],
input[type="week"],
input,
select,
textarea {
&:focus {
border: revert;
box-shadow: revert;
outline: revert;
padding: revert;
}
}
}
4 changes: 4 additions & 0 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function SearchEdit( {
const renderTextField = () => {
return (
<input
type="search"
className="wp-block-search__input"
aria-label={ __( 'Optional placeholder text' ) }
// We hide the placeholder field's placeholder when there is a value. This
Expand Down Expand Up @@ -149,7 +150,10 @@ export default function SearchEdit( {

{ ! buttonUseIcon && (
<RichText
type="submit"
className="wp-block-search__button"
tagName="button"
style={ { display: 'inline-block' } }
aria-label={ __( 'Button text' ) }
placeholder={ __( 'Add button text…' ) }
withoutInteractiveFormatting
Expand Down
24 changes: 0 additions & 24 deletions packages/block-library/src/search/editor.scss

This file was deleted.