Implement the focus_room_filter action#4560
Conversation
This is for ctrl+k room filtering and switching
| import KeyCode from 'matrix-react-sdk/lib/KeyCode'; | ||
| import sdk from 'matrix-react-sdk'; | ||
| import dis from 'matrix-react-sdk/lib/dispatcher'; | ||
| import RateLimitedFunc from 'matrix-react-sdk/lib/ratelimitedfunc'; |
There was a problem hiding this comment.
I would keep the style of this import if possible: it's a function rather than a class / component.
There was a problem hiding this comment.
Weird that it needs a new then?
There was a problem hiding this comment.
Basically the new is to get the this correct in the function, but it's still creating a function rather than an instance of a class, notionally.
|
|
||
| _onKeyDown: function(ev) { | ||
| // Only do anything when the key event target is the search input | ||
| if(ev.target !== this.refs.search) return; |
There was a problem hiding this comment.
Why not just listen for keydown events on the appropriate element?
There was a problem hiding this comment.
Yep, that would be simpler
| dis.dispatch({ | ||
| action: 'view_room', | ||
| room_id: roomId, | ||
| clear_search: (ev && (ev.keyCode == KeyCode.ENTER || ev.keyCode == KeyCode.SPACE)), |
There was a problem hiding this comment.
I'm a bit baffled here: why would a click event have a keyCode?
There was a problem hiding this comment.
This is for when you "clicked" it by focusing and hitting enter or space (which is what the previous impl did).
There was a problem hiding this comment.
Oh, I think I see what's going on - so we rely on you tabbing to the RoomTile and hitting enter rather than the search box handling the enter, in which case this makes sense.
|
This looks like a flaky, unrelated test failure |
|
Yarp fixed in #4564 I hope |
This is for ctrl+k room filtering and switching
codep matrix-org/matrix-react-sdk#1212