From 47f32c196c5d840a6a45799ddf123d17c77274b0 Mon Sep 17 00:00:00 2001 From: HiDeoo <494699+HiDeoo@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:15:45 +0200 Subject: [PATCH] Remove `/` search shortcut (#2025) Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com> Co-authored-by: Chris Swithinbank --- .changeset/big-buttons-shop.md | 7 +++ package.json | 2 +- packages/starlight/components/Search.astro | 64 +++++++++++++++------- packages/starlight/schemas/i18n.ts | 6 +- packages/starlight/style/props.css | 1 + packages/starlight/translations/ar.json | 2 +- packages/starlight/translations/cs.json | 2 +- packages/starlight/translations/da.json | 2 +- packages/starlight/translations/de.json | 2 +- packages/starlight/translations/en.json | 2 +- packages/starlight/translations/es.json | 2 +- packages/starlight/translations/fa.json | 2 +- packages/starlight/translations/fr.json | 2 +- packages/starlight/translations/gl.json | 2 +- packages/starlight/translations/he.json | 2 +- packages/starlight/translations/hi.json | 2 +- packages/starlight/translations/id.json | 2 +- packages/starlight/translations/it.json | 2 +- packages/starlight/translations/ja.json | 2 +- packages/starlight/translations/ko.json | 2 +- packages/starlight/translations/nb.json | 2 +- packages/starlight/translations/nl.json | 2 +- packages/starlight/translations/pl.json | 2 +- packages/starlight/translations/pt.json | 2 +- packages/starlight/translations/ro.json | 2 +- packages/starlight/translations/ru.json | 2 +- packages/starlight/translations/sk.json | 2 +- packages/starlight/translations/sv.json | 2 +- packages/starlight/translations/tr.json | 2 +- packages/starlight/translations/uk.json | 2 +- packages/starlight/translations/vi.json | 2 +- packages/starlight/translations/zh-CN.json | 2 +- packages/starlight/translations/zh-TW.json | 2 +- 33 files changed, 86 insertions(+), 50 deletions(-) create mode 100644 .changeset/big-buttons-shop.md diff --git a/.changeset/big-buttons-shop.md b/.changeset/big-buttons-shop.md new file mode 100644 index 0000000000..ea6ed5e18d --- /dev/null +++ b/.changeset/big-buttons-shop.md @@ -0,0 +1,7 @@ +--- +'@astrojs/starlight': minor +--- + +Removes the `/` search shortcut for [accessibility reasons](https://www.w3.org/WAI/WCAG21/Understanding/character-key-shortcuts.html). + +⚠️ **Potentially breaking change:** The `search.shortcutLabel` UI string has been removed. If you were using this string in your custom UI, you will need to update your code. diff --git a/package.json b/package.json index 443204802e..db0e25204d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "size": "size-limit", "version": "pnpm changeset version && pnpm i --no-frozen-lockfile", "format": "prettier -w --cache --plugin prettier-plugin-astro .", - "typecheck": "astro check" + "typecheck": "astro check --minimumSeverity warning" }, "license": "MIT", "devDependencies": { diff --git a/packages/starlight/components/Search.astro b/packages/starlight/components/Search.astro index 926583eb90..713e941513 100644 --- a/packages/starlight/components/Search.astro +++ b/packages/starlight/components/Search.astro @@ -20,17 +20,17 @@ const pagefindTranslations = { data-translations={JSON.stringify(pagefindTranslations)} data-strip-trailing-slash={project.trailingSlash === 'never'} > - @@ -56,6 +56,27 @@ const pagefindTranslations = { +{ + /** + * This is intentionally inlined to avoid briefly showing an invalid shortcut. + * Purposely using the deprecated `navigator.platform` property to detect Apple devices, as the + * user agent is spoofed by some browsers when opening the devtools. + */ +} + +