search_query: Prevent overflow of long search queries.

Previously, when searching for extremely long queries,
they would overflow beyond the screen.

This commit fixes the bug by ensuring that long
search queries do not overflow.

Fixes: #29568
This commit is contained in:
whilstsomebody
2025-03-06 10:45:21 +05:30
committed by Tim Abbott
parent b16bd27e9c
commit 9b0477d771
3 changed files with 12 additions and 5 deletions

View File

@@ -1329,6 +1329,10 @@ div.toggle_resolve_topic_spinner .loading_indicator_spinner {
.empty-feed-notice-description { .empty-feed-notice-description {
font-size: 1.1em; font-size: 1.1em;
.search-query-word {
word-wrap: break-word;
}
} }
.message-fade, .message-fade,

View File

@@ -17,7 +17,7 @@
{{#if is_stop_word}} {{#if is_stop_word}}
<del>{{query_word}}</del> <del>{{query_word}}</del>
{{else}} {{else}}
<span>{{query_word}}</span> <span class="search-query-word">{{query_word}}</span>
{{/if}} {{/if}}
{{/each}} {{/each}}
{{else}} {{else}}

View File

@@ -136,7 +136,7 @@ run_test("empty_narrow_html", ({mock_template}) => {
Some common words were excluded from your search. <br/>You searched for: Some common words were excluded from your search. <br/>You searched for:
<span>channel: new</span> <span>channel: new</span>
<span>topic: test</span> <span>topic: test</span>
<span>search</span> <span class="search-query-word">search</span>
<del>a</del> <del>a</del>
</div> </div>
</div> </div>
@@ -160,7 +160,7 @@ run_test("empty_narrow_html", ({mock_template}) => {
<div class="empty-feed-notice-description"> <div class="empty-feed-notice-description">
You searched for: You searched for:
<span>channel: hello world</span> <span>channel: hello world</span>
<span>searchA</span> <span class="search-query-word">searchA</span>
</div> </div>
</div> </div>
`, `,
@@ -183,7 +183,7 @@ run_test("empty_narrow_html", ({mock_template}) => {
<div class="empty-feed-notice-description"> <div class="empty-feed-notice-description">
You searched for: You searched for:
<span>topic: hello</span> <span>topic: hello</span>
<span>searchB</span> <span class="search-query-word">searchB</span>
</div> </div>
</div> </div>
`, `,
@@ -608,7 +608,10 @@ run_test("show_empty_narrow_message_with_search", ({mock_template, override}) =>
const current_filter = set_filter([["search", "grail"]]); const current_filter = set_filter([["search", "grail"]]);
narrow_banner.show_empty_narrow_message(current_filter); narrow_banner.show_empty_narrow_message(current_filter);
assert.match($(".empty_feed_notice_main").html(), /<span>grail<\/span>/); assert.match(
$(".empty_feed_notice_main").html(),
/<span class="search-query-word">grail<\/span>/,
);
}); });
run_test("hide_empty_narrow_message", () => { run_test("hide_empty_narrow_message", () => {