mirror of
https://github.com/flarum/framework.git
synced 2025-06-07 09:04: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}
|
* @type {Function}
|
||||||
*/
|
*/
|
||||||
this.value = m.prop();
|
this.value = m.prop('');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the search input has focus.
|
* Whether or not the search input has focus.
|
||||||
@ -131,7 +131,11 @@ export default class Search extends Component {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 13: // Return
|
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();
|
this.$('input').blur();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user