Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Aman Agrawal760e4fc1e7c6
diff --git a/static/js/hotkey.js b/static/js/hotkey.js
index 236d58c2b54..4d3acdf5027 100644
--- a/static/js/hotkey.js
+++ b/static/js/hotkey.js
@@ -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() &&
diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js
index 50a14bbb0de..cdfc4e69741 100644
--- a/static/js/recent_topics.js
+++ b/static/js/recent_topics.js
@@ -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":
diff --git a/static/templates/recent_topics_table.hbs b/static/templates/recent_topics_table.hbs
index e3d4102b085..03382c62c64 100644
--- a/static/templates/recent_topics_table.hbs
+++ b/static/templates/recent_topics_table.hbs
@@ -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>
diff --git a/templates/zerver/app/keyboard_shortcuts.html b/templates/zerver/app/keyboard_shortcuts.html
index b5fe4884320..f2b1885148f 100644
--- a/templates/zerver/app/keyboard_shortcuts.html
+++ b/templates/zerver/app/keyboard_shortcuts.html
@@ -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>
diff --git a/templates/zerver/help/keyboard-shortcuts.md b/templates/zerver/help/keyboard-shortcuts.md
index 7f328d4f2bb..d9626da7706 100644
--- a/templates/zerver/help/keyboard-shortcuts.md
+++ b/templates/zerver/help/keyboard-shortcuts.md
@@ -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.