mirror of
https://github.com/flarum/framework.git
synced 2025-06-05 15:34:33 +08:00
Clear search when input is empty and enter is pressed. fixes #650
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user