diff --git a/lib/rdoc/generator/template/rails/_panel.rhtml b/lib/rdoc/generator/template/rails/_panel.rhtml
index 838f6437..a5ac6d1c 100644
--- a/lib/rdoc/generator/template/rails/_panel.rhtml
+++ b/lib/rdoc/generator/template/rails/_panel.rhtml
@@ -14,7 +14,7 @@
-
diff --git a/lib/rdoc/generator/template/rails/resources/css/main.css b/lib/rdoc/generator/template/rails/resources/css/main.css
index 026e9416..4a47dd18 100644
--- a/lib/rdoc/generator/template/rails/resources/css/main.css
+++ b/lib/rdoc/generator/template/rails/resources/css/main.css
@@ -264,20 +264,6 @@ html {
height: 100dvh;
}
-.panel__search {
- height: var(--search-height);
- width: 100%;
-
- background: url('../i/search.svg') no-repeat;
- background-position: 0.5em center;
- padding-left: calc(0.5em + 16px + 0.5em);
-
- color: inherit;
-
- border: 0;
- box-shadow: 1px 1px 4px color-mix(in srgb, currentColor 50%, transparent) inset;
-}
-
.panel__results, .panel__nav {
position: relative;
height: calc(100dvh - var(--banner-height) - var(--search-height));
@@ -310,6 +296,46 @@ html {
}
+/*
+ * Navigation panel - Search input
+ */
+
+.panel__search {
+ height: var(--search-height);
+ width: 100%;
+
+ background: url('../i/search.svg') no-repeat;
+ background-size: 1.3em;
+ background-position: 0.5em center;
+ padding-left: calc(0.5em + 1.3em + 0.5em);
+
+ color: inherit;
+
+ border: 0;
+ box-shadow: 1px 1px 4px color-mix(in srgb, currentColor 50%, transparent) inset;
+}
+
+/* Hide native magnifying glass icon in Webkit-based browsers (in favor of our icon) */
+.panel__search::-webkit-search-results-button {
+ -webkit-appearance: none;
+}
+
+/* Display "clear search" button consistently across (Webkit-based) browsers */
+.panel__search::-webkit-search-cancel-button {
+ -webkit-appearance: none;
+
+ margin-right: 0.5em;
+ height: 1.3em;
+ width: 1.3em;
+ background: url('../i/close.svg') no-repeat;
+ background-size: contain;
+}
+
+.panel__search:not(:focus)::-webkit-search-cancel-button {
+ display: none;
+}
+
+
/*
* Navigation panel - Search results
*/
diff --git a/lib/rdoc/generator/template/rails/resources/i/search.svg b/lib/rdoc/generator/template/rails/resources/i/search.svg
index 7f4a3652..2e701c06 100644
--- a/lib/rdoc/generator/template/rails/resources/i/search.svg
+++ b/lib/rdoc/generator/template/rails/resources/i/search.svg
@@ -1,12 +1 @@
-
-
+