From 8158cb3cd969dffa5635186eb7764544a6bf7d15 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Thu, 26 May 2022 17:06:56 -0700 Subject: [PATCH] Add site search (poweredy by SearchMySite) Add a search bar to the site footer to search seirdy.one. --- assets/css/dark.css | 4 ++- assets/css/main.css | 51 +++++++++++++++++++++++++----------- assets/css/print.css | 4 +-- layouts/partials/footer.html | 1 + layouts/partials/search.html | 7 +++++ 5 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 layouts/partials/search.html diff --git a/assets/css/dark.css b/assets/css/dark.css index 8f2dfaf..652f8a9 100644 --- a/assets/css/dark.css +++ b/assets/css/dark.css @@ -3,7 +3,9 @@ * stays within the ideal APCA ranges, not lower and preferably not * higher either. */ @media (prefers-color-scheme: dark) { - html { + button, + html, + input { /* Pure white on black causes halation. * "background" is short for a bunch of unnecessary CSS rules * background-color is all I need. diff --git a/assets/css/main.css b/assets/css/main.css index d5accf5..9f8e31e 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -80,18 +80,15 @@ html { /* Compensate for misalignment and wasted space caused by padding * and margin adjustments in nav children made to meet SC 2.5.5 */ - dt > a, - header > nav, footer > nav, + header > nav, + dt > a, h2 + a { margin-left: -.25em; } header > nav { margin-bottom: -.75em; } - footer > nav { - margin-top: -.75em; - } summary { /* The tappable region of a extends across the page. @@ -110,12 +107,6 @@ html { margin: .5em .25em; } - /* Google a11y: ensure tap targets have >=8px space between them */ - nav li, - li details li { - padding: 1em 0; - } - /* SC 2.5.5, Google a11y: Increase tap target size a bit * - Summary is a tappable button * - standalone links in lists are usually parts of collections of @@ -126,7 +117,10 @@ html { dt > a, summary, h2 + a, - li > a { + li > a, + nav li, + li details li, + input { padding: .875em .25em; } @@ -181,6 +175,27 @@ nav ul li { margin-right: .375em; } +/* Make search box and submit button wide enough */ +form { + display: table; + width: 100% +} + +input[type="search"] { + display: table-cell; + width: 100%; +} + +form > div { + display: table-cell; + width: 1%; +} + +/* Don't shrink the size of the text in forms. */ +input { + font-size: inherit; +} + /* narrow screens: reduce margin for blockquotes a lot, using * a border instead. Put it on the left and right to make it * LTR/RTL-neutral, for machine translators that change text @@ -198,8 +213,9 @@ h1 { hyphens: auto; } -/* Very narrow screens: full hyphenation */ -@media (max-width: 13em) { +/* Very narrow screens: full hyphenation. + * This is the typical width of a smart feature phone. */ +@media (max-width: 15em) { body { font-size: 100%; -webkit-hyphens: auto; @@ -270,6 +286,7 @@ pre { * too similar to the page background color. Also put a border around *
 and  to distinguish them in ways besides font-family.
  * This is Technique C25 of SC 1.4.8 */
+input,
 img,
 pre {
 	border: 1px solid;
@@ -326,11 +343,13 @@ section[aria-labelledby="webmentions"] {
 
 a:focus,
 summary:focus,
-pre[tabindex]:focus {
+pre[tabindex]:focus,
+form :focus {
 	outline: 3px solid;
 }
 
-/* Remove :focus styling for browsers that do support :focus-visible */
+/* Remove :focus styling for browsers that do support :focus-visible.
+ * Leave it on for form stuff. */
 @supports selector(:focus-visible) {
 	a:focus:not(:focus-visible),
 	summary:focus:not(:focus-visible),
diff --git a/assets/css/print.css b/assets/css/print.css
index dd2c442..12f74f4 100644
--- a/assets/css/print.css
+++ b/assets/css/print.css
@@ -8,7 +8,7 @@
 
 	/* Hide screen-only content */
 
-	aside,
+	aside:not([role="note"]),
 	/* An un-opened summary inside an article has no use in print.
 	 * Outside an article it's used in my webring list where it has some
 	 * use, see below. */
@@ -17,7 +17,7 @@
 	 * useless in printouts. */
 	h2 + a,
   /* You can't navigate in a printout. */
-	footer nav,
+	footer,
 	nav a:not([rel="home"]) span {
 		display: none;
 	}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 775d5f8..9b3cfac 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -2,6 +2,7 @@
 	

Copyright {{- partial "indieweb-author.html" -}}

+ {{ partial "search.html" }}