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: Fix search clear icon overflowing in next line.

Aman Agrawalc4bbdf040e95
diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js
index f0fb65f48a2..4c722fd4466 100644
--- a/static/js/recent_topics.js
+++ b/static/js/recent_topics.js
@@ -434,6 +434,10 @@ exports.launch = function () {
exports.complete_rerender();
};
+function filter_buttons() {
+ return $('#recent_filters_group').children();
+}
+
exports.change_focused_element = function (e, input_key) {
// Called from hotkeys.js; like all logic in that module,
// returning true will cause the caller to do
@@ -472,13 +476,13 @@ exports.change_focused_element = function (e, input_key) {
if (start !== 0 || is_selected) {
return false;
}
- current_focus_elem = $elem.prev().children().last();
+ current_focus_elem = filter_buttons().last();
break;
case 'right_arrow':
if (end !== text_length || is_selected) {
return false;
}
- current_focus_elem = $elem.prev().children().first();
+ current_focus_elem = filter_buttons().first();
break;
case 'down_arrow':
set_table_focus(row_focus, col_focus);
@@ -496,14 +500,14 @@ exports.change_focused_element = function (e, input_key) {
} else if ($elem.hasClass('btn-recent-filters')) {
switch (input_key) {
case 'left_arrow':
- if ($elem.parent().children().first()[0] === $elem[0]) {
+ if (filter_buttons().first()[0] === $elem[0]) {
current_focus_elem = $("#recent_topics_search");
} else {
current_focus_elem = $elem.prev();
}
break;
case 'right_arrow':
- if ($elem.parent().children().last()[0] === $elem[0]) {
+ if (filter_buttons().last()[0] === $elem[0]) {
current_focus_elem = $("#recent_topics_search");
} else {
current_focus_elem = $elem.next();
diff --git a/static/styles/recent_topics.scss b/static/styles/recent_topics.scss
index 177599e6d2f..a412229c4f9 100644
--- a/static/styles/recent_topics.scss
+++ b/static/styles/recent_topics.scss
@@ -120,13 +120,19 @@
justify-content: flex-start;
}
- #recent_topics_search {
+ .search_group {
+ display: flex;
+ flex-grow: 1;
margin: 0 0 10px 0px;
+ }
+
+ #recent_topics_search {
flex-grow: 1;
}
- #recent_topics_search_clear {
- margin-top: -10px !important;
+ .clear_search_button {
+ // Overrides app_components.scss property.
+ padding-top: 6px !important;
}
.btn-recent-filters {
diff --git a/static/templates/recent_topics_table.hbs b/static/templates/recent_topics_table.hbs
index 055f7f5f800..821eb5f1fc0 100644
--- a/static/templates/recent_topics_table.hbs
+++ b/static/templates/recent_topics_table.hbs
@@ -2,10 +2,12 @@
<div id="recent_filters_group">
{{> recent_topics_filters}}
</div>
- <input type="text" id="recent_topics_search" value="{{ search_val }}" placeholder="{{t 'Search stream / topic' }}">
- <button type="button" class="btn clear_search_button" id="recent_topics_search_clear">
- <i class="fa fa-remove" aria-hidden="true"></i>
- </button>
+ <div class="search_group" role="group">
+ <input type="text" id="recent_topics_search" value="{{ search_val }}" placeholder="{{t 'Search stream / topic' }}">
+ <button type="button" class="btn clear_search_button" id="recent_topics_search_clear">
+ <i class="fa fa-remove" aria-hidden="true"></i>
+ </button>
+ </div>
</div>
<div class="table_fix_head">
<table class="table table-responsive table-hover">