Remove las sibling selector from search

This commit is contained in:
Tetrakern 2023-06-10 01:11:44 +02:00
parent a49f4bf130
commit 6d3deb28fe
6 changed files with 33 additions and 22 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,13 @@ if ( ! $skip_author_keywords ) {
?>
<form role="search" method="get" class="search-form <?php if ( ! $show_advanced ) echo '_simple'; ?>" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<form
role="search"
method="get"
class="search-form <?php if ( ! $show_advanced ) echo '_simple'; ?>"
action="<?php echo esc_url( home_url( '/' ) ); ?>"
data-advanced="false"
>
<?php if ( $show_advanced ) : ?>
<div class="allow-list" hidden><?php echo json_encode( $allow_list ); ?></div>

View File

@ -1767,6 +1767,13 @@ _$$('.search-form').forEach(form => {
});
});
_$('.search-form__advanced-control')?.addEventListener(
'change',
event => {
event.currentTarget.closest('form').dataset.advanced = event.currentTarget.checked;
}
);
// =============================================================================
// DETECT KEYBOARD USER (UNNECESSARILY COMPLICATED EDITION)
// =============================================================================

View File

@ -1,3 +1,19 @@
.search-form[data-advanced="false"] {
.search-form__advanced {
display: none;
}
}
.search-form[data-advanced="true"] {
.search-form__bar .search-form__advanced-toggle {
color: var(--fg-600);
}
.search-form__current {
display: none;
}
}
.search-form {
&._simple {
.search-form__bar input {
@ -155,24 +171,6 @@
}
}
&-control {
&:not(:checked) {
~ .search-form__advanced {
display: none;
}
}
&:checked {
+ .search-form__bar .search-form__advanced-toggle {
color: var(--fg-600);
}
~ .search-form__current {
display: none;
}
}
}
&-actions {
display: flex;
justify-content: space-between;