Skip to content

Commit 668199e

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 498feee + 248944a commit 668199e

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

‎src/components/structures/RoomSubList.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
3030
var FormattingUtils = require('matrix-react-sdk/lib/utils/FormattingUtils');
3131
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
3232
import Modal from 'matrix-react-sdk/lib/Modal';
33+
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
3334

3435
// turn this on for drop & drag console debugging galore
3536
var debug = false;
@@ -151,10 +152,11 @@ var RoomSubList = React.createClass({
151152
}
152153
},
153154

154-
onRoomTileClick(roomId) {
155+
onRoomTileClick(roomId, ev) {
155156
dis.dispatch({
156157
action: 'view_room',
157158
room_id: roomId,
159+
clear_search: (ev && (ev.keyCode == KeyCode.ENTER || ev.keyCode == KeyCode.SPACE)),
158160
});
159161
},
160162

‎src/components/structures/SearchBox.js‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ limitations under the License.
1616

1717
'use strict';
1818

19-
var React = require('react');
19+
import React from 'react';
2020
import { _t } from 'matrix-react-sdk/lib/languageHandler';
21-
var sdk = require('matrix-react-sdk')
22-
var dis = require('matrix-react-sdk/lib/dispatcher');
23-
var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
24-
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
21+
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
22+
import sdk from 'matrix-react-sdk';
23+
import dis from 'matrix-react-sdk/lib/dispatcher';
24+
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
25+
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
2526

2627
module.exports = React.createClass({
2728
displayName: 'SearchBox',
@@ -46,18 +47,19 @@ module.exports = React.createClass({
4647
},
4748

4849
onAction: function(payload) {
49-
// Disabling this as I find it really really annoying, and was used to the
50-
// previous behaviour - see https://github.com/vector-im/riot-web/issues/3348
51-
/*
5250
switch (payload.action) {
53-
// Clear up the text field when a room is selected.
5451
case 'view_room':
55-
if (this.refs.search) {
52+
if (this.refs.search && payload.clear_search) {
5653
this._clearSearch();
5754
}
5855
break;
56+
case 'focus_room_filter':
57+
if (this.refs.search) {
58+
this.refs.search.focus();
59+
this.refs.search.select();
60+
}
61+
break;
5962
}
60-
*/
6163
},
6264

6365
onChange: function() {
@@ -86,6 +88,15 @@ module.exports = React.createClass({
8688
}
8789
},
8890

91+
_onKeyDown: function(ev) {
92+
switch (ev.keyCode) {
93+
case KeyCode.ESCAPE:
94+
this._clearSearch();
95+
dis.dispatch({action: 'focus_composer'});
96+
break;
97+
}
98+
},
99+
89100
_clearSearch: function() {
90101
this.refs.search.value = "";
91102
this.onChange();
@@ -135,6 +146,7 @@ module.exports = React.createClass({
135146
className="mx_SearchBox_search"
136147
value={ this.state.searchTerm }
137148
onChange={ this.onChange }
149+
onKeyDown={ this._onKeyDown }
138150
placeholder={ _t('Filter room names') }
139151
/>
140152
];

0 commit comments

Comments
 (0)