Make all keybindings in docsite have title (#1580)

This commit is contained in:
Evan Simkowitz 2024-12-19 13:50:26 -08:00 committed by GitHub
parent 009bd39cb0
commit 8262653361
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,9 +38,9 @@ function convertKey(platform: Platform, key: string): [any, string, boolean] {
return ["⇧", "Shift", true]; return ["⇧", "Shift", true];
} }
if (key == "Escape") { if (key == "Escape") {
return ["Esc", null, false]; return ["Esc", "Escape", false];
} }
return [key, null, false]; return [key.length > 1 ? key : key.toUpperCase(), key, false];
} }
// Custom KBD component // Custom KBD component
@ -50,7 +50,7 @@ const KbdInternal = ({ k }: { k: string }) => {
const keyElems = keys.map((key, i) => { const keyElems = keys.map((key, i) => {
const [displayKey, title, symbol] = convertKey(platform, key); const [displayKey, title, symbol] = convertKey(platform, key);
return ( return (
<kbd key={i} title={title} className={symbol ? "symbol" : null}> <kbd key={i} title={title} aria-label={title} className={symbol ? "symbol" : null}>
{displayKey} {displayKey}
</kbd> </kbd>
); );