mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-13 17:57:06 +00:00
Merge "Remove dependency on .cdx-typeahead-search--active
class"
This commit is contained in:
commit
ddc3125f74
|
@ -2,6 +2,7 @@
|
||||||
<cdx-typeahead-search
|
<cdx-typeahead-search
|
||||||
:id="id"
|
:id="id"
|
||||||
ref="searchForm"
|
ref="searchForm"
|
||||||
|
class="vector-typeahead-search"
|
||||||
:class="rootClasses"
|
:class="rootClasses"
|
||||||
:search-results-label="$i18n( 'searchresults' ).text()"
|
:search-results-label="$i18n( 'searchresults' ).text()"
|
||||||
:accesskey="searchAccessKey"
|
:accesskey="searchAccessKey"
|
||||||
|
@ -19,6 +20,8 @@
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
@search-result-click="instrumentation.onSuggestionClick"
|
@search-result-click="instrumentation.onSuggestionClick"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
|
@focus="onFocus"
|
||||||
|
@blur="onBlur"
|
||||||
>
|
>
|
||||||
<template #default>
|
<template #default>
|
||||||
<input
|
<input
|
||||||
|
@ -132,13 +135,16 @@ module.exports = exports = defineComponent( {
|
||||||
// Whether to apply a CSS class that disables the CSS transitions on the text input
|
// Whether to apply a CSS class that disables the CSS transitions on the text input
|
||||||
disableTransitions: this.autofocusInput,
|
disableTransitions: this.autofocusInput,
|
||||||
|
|
||||||
instrumentation: instrumentation.listeners
|
instrumentation: instrumentation.listeners,
|
||||||
|
|
||||||
|
isFocused: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
rootClasses() {
|
rootClasses() {
|
||||||
return {
|
return {
|
||||||
'vector-search-box-disable-transitions': this.disableTransitions
|
'vector-search-box-disable-transitions': this.disableTransitions,
|
||||||
|
'vector-typeahead-search--active': this.isFocused
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -183,6 +189,14 @@ module.exports = exports = defineComponent( {
|
||||||
this.wprov = instrumentation.getWprovFromResultIndex( event.index );
|
this.wprov = instrumentation.getWprovFromResultIndex( event.index );
|
||||||
|
|
||||||
instrumentation.listeners.onSubmit( event );
|
instrumentation.listeners.onSubmit( event );
|
||||||
|
},
|
||||||
|
|
||||||
|
onFocus() {
|
||||||
|
this.isFocused = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
onBlur() {
|
||||||
|
this.isFocused = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
// https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/text-input/TextInput.vue#257
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/text-input/TextInput.vue#257
|
||||||
@padding-left-start-icon: 36px;
|
@padding-left-start-icon: 36px;
|
||||||
|
|
||||||
.cdx-typeahead-search {
|
.vector-typeahead-search {
|
||||||
// Hide the button, only show it on hover or when the input or the button itself is focused
|
// Hide the button, only show it on hover or when the input or the button itself is focused
|
||||||
.cdx-search-input__end-button {
|
.cdx-search-input__end-button {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@ exports[`App renders a typeahead search component 1`] = `
|
||||||
aria-label="Search MediaWiki"
|
aria-label="Search MediaWiki"
|
||||||
autoexpandwidth="false"
|
autoexpandwidth="false"
|
||||||
buttonlabel="searchbutton"
|
buttonlabel="searchbutton"
|
||||||
class=""
|
class="vector-typeahead-search"
|
||||||
debounceinterval="120"
|
debounceinterval="120"
|
||||||
formaction=""
|
formaction=""
|
||||||
highlightquery="true"
|
highlightquery="true"
|
||||||
|
|
Loading…
Reference in a new issue