@primer/react
Version:
An implementation of GitHub's Primer Design System using React
18 lines (17 loc) • 1.11 kB
JavaScript
import { accessibleSequenceString } from "./components/utils.js";
//#region src/KeybindingHint/utils.ts
/**
* AVOID: `KeybindingHint` is nearly always sufficient for providing both visible and accessible keyboard hints.
* However, there may be cases where we need a plain string version, such as when building `aria-label` or
* `aria-description`. In that case, this plain string builder can be used instead.
*
* NOTE that this string should _only_ be used when building `aria-label` or `aria-description` props (never rendered
* visibly) and should nearly always also be paired with a visible hint for sighted users.
*
* The `platform` argument controls how platform-specific keys (such as `Meta`, `Alt`, and `Mod`) are named. For
* backwards compatibility, a `boolean` may be passed instead, where `true` is treated as `'apple'` and `false` is
* treated as `'other'`.
*/
const getAccessibleKeybindingHintString = (sequence, platform) => accessibleSequenceString(sequence, typeof platform === "boolean" ? platform ? "apple" : "other" : platform);
//#endregion
export { getAccessibleKeybindingHintString };