Skip to content

Commit

Permalink
fix(core): 馃悰 inconsistent search focus behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Jul 16, 2023
1 parent 6af0900 commit 1aba52b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions resources/skins.citizen.scripts/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ function renderSearchClearButton( input ) {
input.focus();
} );

input.addEventListener( 'input', ( event ) => {
if ( event.target.value === '' ) {
input.addEventListener( 'input', () => {
if ( input.value === '' ) {
clearButton.remove();
} else {
event.target.after( clearButton );
input.after( clearButton );
}
} );
}
Expand Down Expand Up @@ -204,13 +204,13 @@ function initSearch( window ) {
if ( isPrimarySearch ) {
const checkbox = document.getElementById( 'citizen-search__checkbox' );
bindExpandOnSlash( window, checkbox, input );
renderSearchClearButton( input );
// Focus when toggled
checkbox.addEventListener( 'input', () => {
focusOnChecked( checkbox, input );
} );
}

renderSearchClearButton( input );
setLoadingIndicatorListeners( searchBox, true, renderSearchLoadingIndicator );
loadSearchModule( input, searchModule, () => {
setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator );
Expand Down

0 comments on commit 1aba52b

Please sign in to comment.