mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(search) Add a screenreader-only alert when the search filters are updated to make it easier to understand what happens.
This commit is contained in:
parent
01f242ac7e
commit
3548d54cf6
@ -17,33 +17,34 @@ public record SearchParameters(String query,
|
||||
SearchRecentParameter recent,
|
||||
SearchTitleParameter searchTitle,
|
||||
SearchAdtechParameter adtech,
|
||||
boolean poisonResults
|
||||
boolean poisonResults,
|
||||
boolean newFilter
|
||||
) {
|
||||
public String profileStr() {
|
||||
return profile.filterId;
|
||||
}
|
||||
|
||||
public SearchParameters withProfile(SearchProfile profile) {
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults);
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults, true);
|
||||
}
|
||||
|
||||
public SearchParameters withJs(SearchJsParameter js) {
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults);
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults, true);
|
||||
}
|
||||
public SearchParameters withAdtech(SearchAdtechParameter adtech) {
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults);
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults, true);
|
||||
}
|
||||
|
||||
public SearchParameters withRecent(SearchRecentParameter recent) {
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults);
|
||||
return new SearchParameters(query, profile, js, recent, searchTitle, adtech, poisonResults, true);
|
||||
}
|
||||
|
||||
public SearchParameters withTitle(SearchTitleParameter title) {
|
||||
return new SearchParameters(query, profile, js, recent, title, adtech, poisonResults);
|
||||
return new SearchParameters(query, profile, js, recent, title, adtech, poisonResults, true);
|
||||
}
|
||||
|
||||
public String renderUrl(WebsiteUrl baseUrl) {
|
||||
String path = String.format("/search?query=%s&profile=%s&js=%s&adtech=%s&recent=%s&searchTitle=%s",
|
||||
String path = String.format("/search?query=%s&profile=%s&js=%s&adtech=%s&recent=%s&searchTitle=%s&newfilter=true",
|
||||
URLEncoder.encode(query, StandardCharsets.UTF_8),
|
||||
URLEncoder.encode(profile.filterId, StandardCharsets.UTF_8),
|
||||
URLEncoder.encode(js.value, StandardCharsets.UTF_8),
|
||||
|
@ -26,4 +26,5 @@ public class DecoratedSearchResults {
|
||||
public String getAdtech() { return params.adtech().value; }
|
||||
public String getRecent() { return params.recent().value; }
|
||||
public String getSearchTitle() { return params.searchTitle().value; }
|
||||
public Boolean isNewFilter() { return params.newFilter(); }
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ public class SearchQueryService {
|
||||
SearchRecentParameter.parse(request.queryParams("recent")),
|
||||
SearchTitleParameter.parse(request.queryParams("searchTitle")),
|
||||
SearchAdtechParameter.parse(request.queryParams("adtech")),
|
||||
"1".equals(request.headers("X-Poison-Results"))
|
||||
"1".equals(request.headers("X-Poison-Results")),
|
||||
"true".equals(request.queryParams("newfilter"))
|
||||
);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
@ -12,11 +12,14 @@
|
||||
|
||||
<body data-filter="{{filters.currentFilter}}">
|
||||
|
||||
{{#if newFilter}} <div class="screenreader-only" aria-role="status">Search Filters Updated</div> {{/if}}
|
||||
|
||||
<!-- Hi there, fellow human being :-) -->
|
||||
|
||||
{{>search/parts/search-header}}
|
||||
{{>search/parts/search-form}}
|
||||
|
||||
|
||||
<span id="content-start"></span>
|
||||
|
||||
<section class="sidebar-narrow">
|
||||
|
@ -15,7 +15,7 @@ class BangCommandTest {
|
||||
try {
|
||||
bangCommand.process(null,
|
||||
new SearchParameters(" !g test",
|
||||
null, null, null, null, null, false)
|
||||
null, null, null, null, null, false, false)
|
||||
);
|
||||
Assertions.fail("Should have thrown RedirectException");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user