Skip to content

A platform for community discussion. Free, open, simple.

A11Y: improve markup of 404 page search form (#26322)

Kris2f307b8f54eb
diff --git a/app/assets/stylesheets/common/base/not-found.scss b/app/assets/stylesheets/common/base/not-found.scss
index 8738f3f5e74..6cf7a3ab4be 100644
--- a/app/assets/stylesheets/common/base/not-found.scss
+++ b/app/assets/stylesheets/common/base/not-found.scss
@@ -53,3 +53,11 @@
flex-basis: 100%;
}
}
+
+.page-not-found-search {
+ label {
+ color: var(--primary);
+ font-size: var(--font-up-3);
+ margin-bottom: 0.5em;
+ }
+}
diff --git a/app/views/exceptions/not_found.html.erb b/app/views/exceptions/not_found.html.erb
index c2b06f4d2ab..373a6c18059 100644
--- a/app/views/exceptions/not_found.html.erb
+++ b/app/views/exceptions/not_found.html.erb
@@ -21,13 +21,11 @@
<%- unless @hide_search%>
<div class="row">
<div class="page-not-found-search">
- <h2><%= t 'page_not_found.search_title' %></h2>
- <p>
- <form action='<%= path "/search" %>' id='discourse-search'>
- <input type="text" name="q" value="<%= @slug %>">
- <button class="btn btn-primary"><%= t 'page_not_found.search_button' %></button>
- </form>
- </p>
+ <form action='<%= path "/search" %>' id='discourse-search'>
+ <label for="search-input"><%= t 'page_not_found.search_title' %></label>
+ <input type="text" id="search-input" name="q" value="<%= @slug %>">
+ <button class="btn btn-primary"><%= t 'page_not_found.search_button' %></button>
+ </form>
</div>
</div>