1
0
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:
Toby Zerner 2016-01-13 10:06:04 +10:30
parent ba7fba9015
commit aaab2cc86e

View File

@ -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;