mirror of
https://github.com/flarum/core.git
synced 2025-02-25 19:53:48 +01:00
Clear search when input is empty and enter is pressed. fixes #650
This commit is contained in:
parent
ba7fba9015
commit
aaab2cc86e
@ -23,7 +23,7 @@ export default class Search extends Component {
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.value = m.prop();
|
||||
this.value = m.prop('');
|
||||
|
||||
/**
|
||||
* Whether or not the search input has focus.
|
||||
@ -131,7 +131,11 @@ export default class Search extends Component {
|
||||
break;
|
||||
|
||||
case 13: // Return
|
||||
m.route(this.getItem(this.index).find('a').attr('href'));
|
||||
if (this.value()) {
|
||||
m.route(this.getItem(this.index).find('a').attr('href'));
|
||||
} else {
|
||||
this.clear();
|
||||
}
|
||||
this.$('input').blur();
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user