File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ export default defineConfig({
6161 starlightLinksValidator ( { errorOnLocalLinks : false } ) ,
6262 starlightImageZoom ( ) ,
6363 ] ,
64+ head : [
65+ {
66+ tag : 'script' ,
67+ attrs : {
68+ src : '/dbLinter/keyboard-nav.js' ,
69+ defer : true ,
70+ } ,
71+ } ,
72+ ] ,
6473 } ) ,
6574 mermaid ( {
6675 theme : 'forest' ,
Original file line number Diff line number Diff line change 1+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
2+ document . addEventListener ( 'keydown' , ( event ) => {
3+ // Ignore if user is typing in an input, textarea, or contenteditable element
4+ if (
5+ event . target . matches ( 'input, textarea, [contenteditable="true"]' ) ||
6+ event . ctrlKey ||
7+ event . metaKey ||
8+ event . altKey
9+ ) {
10+ return ;
11+ }
12+
13+ // Find pagination links
14+ const pagination = document . querySelector ( '.pagination-links' ) ;
15+ if ( ! pagination ) return ;
16+
17+ if ( event . key === 'p' || event . key === 'P' ) {
18+ // Navigate to previous page
19+ const prevLink = pagination . querySelector ( 'a[rel="prev"]' ) ;
20+ if ( prevLink ) {
21+ event . preventDefault ( ) ;
22+ window . location . href = prevLink . href ;
23+ }
24+ } else if ( event . key === 'n' || event . key === 'N' ) {
25+ // Navigate to next page
26+ const nextLink = pagination . querySelector ( 'a[rel="next"]' ) ;
27+ if ( nextLink ) {
28+ event . preventDefault ( ) ;
29+ window . location . href = nextLink . href ;
30+ }
31+ }
32+ } ) ;
33+ } ) ;
You can’t perform that action at this time.
0 commit comments