recent_topics: Focus on search box on `t` keypress.

This commit is contained in:
Aman Agrawal 2020-09-23 13:13:59 +05:30 committed by Tim Abbott
parent 8d398ddd54
commit 760e4fc1e7
5 changed files with 10 additions and 1 deletions

View File

@ -477,6 +477,7 @@ exports.process_hotkey = function (e, hotkey) {
case "vim_right":
case "tab":
case "shift_tab":
case "open_recent_topics":
if (
["#recent_topics", "#", ""].includes(window.location.hash) &&
!popovers.any_active() &&

View File

@ -600,6 +600,9 @@ exports.change_focused_element = function (e, input_key) {
// wraparound. Going off the top or the bottom takes one
// to the navigation at the top (see set_table_focus).
switch (input_key) {
case "open_recent_topics":
set_default_focus();
return true;
case "shift_tab":
case "vim_left":
case "left_arrow":

View File

@ -3,7 +3,7 @@
{{> recent_topics_filters}}
</div>
<div class="search_group" role="group">
<input type="text" id="recent_topics_search" value="{{ search_val }}" placeholder="{{t 'Search stream / topic' }}">
<input type="text" id="recent_topics_search" value="{{ search_val }}" placeholder="{{t 'Search stream / topic (t)' }}">
<button type="button" class="btn clear_search_button" id="recent_topics_search_clear">
<i class="fa fa-remove" aria-hidden="true"></i>
</button>

View File

@ -243,6 +243,10 @@
<td class="definition">{% trans %}View recent topics{% endtrans %}</td>
<td><span class="hotkey"><kbd>T</kbd> or <kbd>Esc</kbd> or <kbd>Ctrl</kbd> + <kbd>[</kbd></span></td>
</tr>
<tr>
<td class="definition">{% trans %}Search recent topics{% endtrans %}</td>
<td><span class="hotkey"><kbd>T</kbd></span></td>
</tr>
</table>
</div>
<div>

View File

@ -140,6 +140,7 @@ title="thumbs up"/>**: `+`
## Recent topics
* **View recent topics**: `t` or `Esc` or `Ctrl` + `[`
* **Search recent topics**: `t`
Keyboard navigation (e.g. arrow keys) works as expected.
Use `Enter` to engage with elements.