File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,6 +335,11 @@ input[type='search']::-webkit-search-results-decoration {
335335 animation-timing-function : cubic-bezier (0.22 , 1 , 0.36 , 1 );
336336}
337337
338+ /* Hide keyboard shortcut hints before hydration when user disabled them */
339+ : root[data-kbd-shortcuts = 'false' ] [data-kbd-hint ] {
340+ display : none;
341+ }
342+
338343/* Locking the scroll whenever any of the modals are open */
339344html : has (dialog : modal ) {
340345 overflow : hidden;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const props = withDefaults(
2727const el = useTemplateRef (' el' )
2828
2929const keyboardShortcutsEnabled = useKeyboardShortcuts ()
30+ const showKbdHint = computed (() => keyboardShortcutsEnabled .value && !! props .ariaKeyshortcuts )
3031
3132defineExpose ({
3233 focus : () => el .value ?.focus (),
@@ -63,7 +64,8 @@ defineExpose({
6364 <span v-if =" classicon" class =" size-[1em]" :class =" classicon" aria-hidden =" true" />
6465 <slot />
6566 <kbd
66- v-if =" keyboardShortcutsEnabled && ariaKeyshortcuts"
67+ v-if =" showKbdHint"
68+ data-kbd-hint
6769 class =" ms-2 inline-flex items-center justify-center w-4 h-4 text-xs text-fg bg-bg-muted border border-border rounded no-underline"
6870 aria-hidden =" true"
6971 >
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ const isButton = computed(() => !isLink.value)
6060const isButtonSmall = computed (() => props .size === ' small' && ! isLink .value )
6161const isButtonMedium = computed (() => props .size === ' medium' && ! isLink .value )
6262const keyboardShortcutsEnabled = useKeyboardShortcuts ()
63+ const showKbdHint = computed (() => keyboardShortcutsEnabled .value && !! props .ariaKeyshortcuts )
6364 </script >
6465
6566<template >
@@ -115,7 +116,8 @@ const keyboardShortcutsEnabled = useKeyboardShortcuts()
115116 aria-hidden =" true"
116117 />
117118 <kbd
118- v-if =" keyboardShortcutsEnabled && ariaKeyshortcuts"
119+ v-if =" showKbdHint"
120+ data-kbd-hint
119121 class =" ms-2 inline-flex items-center justify-center size-4 text-xs text-fg bg-bg-muted border border-border rounded no-underline"
120122 aria-hidden =" true"
121123 >
Original file line number Diff line number Diff line change @@ -53,5 +53,10 @@ export function initPreferencesOnPrehydrate() {
5353 document . documentElement . dataset . pm = pm
5454
5555 document . documentElement . dataset . collapsed = settings . sidebar ?. collapsed ?. join ( ' ' ) ?? ''
56+
57+ // Keyboard shortcuts (default: true)
58+ if ( settings . keyboardShortcuts === false ) {
59+ document . documentElement . dataset . kbdShortcuts = 'false'
60+ }
5661 } )
5762}
You can’t perform that action at this time.
0 commit comments