File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,20 @@ function handleGlobalKeydown(e: KeyboardEvent) {
5959
6060 router .push (' /search' )
6161 }
62+
63+ if (e .key === ' ?' ) {
64+ e .preventDefault ()
65+ const kbdElements = document .querySelectorAll (' kbd' )
66+ for (const kbd of kbdElements ) {
67+ kbd .classList .remove (' kbd-highlight' )
68+ kbd .classList .add (' kbd-highlight' )
69+ }
70+ setTimeout (() => {
71+ for (const kbd of kbdElements ) {
72+ kbd .classList .remove (' kbd-highlight' )
73+ }
74+ }, 700 )
75+ }
6276}
6377
6478if (import .meta .client ) {
@@ -81,3 +95,24 @@ if (import.meta.client) {
8195 <ScrollToTop />
8296 </div >
8397</template >
98+
99+ <style >
100+ @keyframes kbd-highlight {
101+ 0% {
102+ box-shadow : none ;
103+ }
104+ 15% {
105+ box-shadow : 0 0 4px 2px var (--accent );
106+ }
107+ 60% {
108+ box-shadow : 0 0 4px 2px var (--accent );
109+ }
110+ 100% {
111+ box-shadow : none ;
112+ }
113+ }
114+
115+ kbd .kbd-highlight {
116+ animation : kbd-highlight 0.7s ease-out ;
117+ }
118+ </style >
You can’t perform that action at this time.
0 commit comments