diff options
author | Fomafix <fomafix@googlemail.com> | 2019-05-29 11:18:47 +0200 |
---|---|---|
committer | Fomafix <fomafix@googlemail.com> | 2019-05-30 00:01:19 +0200 |
commit | fd573383038356f27da73d724848a6329ee3f637 (patch) | |
tree | 2897e0dc52d97c4954eb17db75c6734d1254a3b8 /resources/src/jquery/jquery.suggestions.js | |
parent | ceb1cd276fd6b46bf063b30232dd54af2c613b01 (diff) | |
download | mediawikicore-fd573383038356f27da73d724848a6329ee3f637.tar.gz mediawikicore-fd573383038356f27da73d724848a6329ee3f637.zip |
jquery.suggestions: Do not show suggestions on prefilled values
Show the suggestions on load only if the current value differs to the
defaultValue from the HTML. This prevents suggestions if there is
already a prefilled value in the input field.
Also direct call $.suggestions.update() instead of trigger a keypress.
This change is a follow-up to 72f61f7a5930cf03d4e8ddde62c2ef627b05dd69.
Bug: T224524
Change-Id: I501596996a20c62d1497bf66e23c7858b58bf4ea
Diffstat (limited to 'resources/src/jquery/jquery.suggestions.js')
-rw-r--r-- | resources/src/jquery/jquery.suggestions.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 9e6ecc888d18..e970c0637e33 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -776,10 +776,12 @@ } $.suggestions.hide( context ); $.suggestions.cancel( context ); - } ) - // Simulate a keypress on load. This loads the search suggestions when there are already - // typed characters before the JavaScript is loaded. - .trigger( 'keypress' ); + } ); + // Load suggestions if the value is changed because there are already + // typed characters before the JavaScript is loaded. + if ( this.value !== this.defaultValue ) { + $.suggestions.update( context, false ); + } } // Store the context for next time |