mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-13 17:49:25 +00:00
fix(core): 🐛 inconsistent search focus behavior
This commit is contained in:
parent
6af0900185
commit
1aba52b870
|
@ -169,11 +169,11 @@ function renderSearchClearButton( input ) {
|
||||||
input.focus();
|
input.focus();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
input.addEventListener( 'input', ( event ) => {
|
input.addEventListener( 'input', () => {
|
||||||
if ( event.target.value === '' ) {
|
if ( input.value === '' ) {
|
||||||
clearButton.remove();
|
clearButton.remove();
|
||||||
} else {
|
} else {
|
||||||
event.target.after( clearButton );
|
input.after( clearButton );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -204,13 +204,13 @@ function initSearch( window ) {
|
||||||
if ( isPrimarySearch ) {
|
if ( isPrimarySearch ) {
|
||||||
const checkbox = document.getElementById( 'citizen-search__checkbox' );
|
const checkbox = document.getElementById( 'citizen-search__checkbox' );
|
||||||
bindExpandOnSlash( window, checkbox, input );
|
bindExpandOnSlash( window, checkbox, input );
|
||||||
renderSearchClearButton( input );
|
|
||||||
// Focus when toggled
|
// Focus when toggled
|
||||||
checkbox.addEventListener( 'input', () => {
|
checkbox.addEventListener( 'input', () => {
|
||||||
focusOnChecked( checkbox, input );
|
focusOnChecked( checkbox, input );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderSearchClearButton( input );
|
||||||
setLoadingIndicatorListeners( searchBox, true, renderSearchLoadingIndicator );
|
setLoadingIndicatorListeners( searchBox, true, renderSearchLoadingIndicator );
|
||||||
loadSearchModule( input, searchModule, () => {
|
loadSearchModule( input, searchModule, () => {
|
||||||
setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator );
|
setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator );
|
||||||
|
|
Loading…
Reference in a new issue