File tree Expand file tree Collapse file tree
Source Code/layouts/partials/resources Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 Your browser does not support the audio element.
3333 </ audio >
3434
35- < button id ="music-btn " class ="music-btn " aria-label ="Toggle Focus Music ">
35+ < button id ="music-btn " class ="music-btn " aria-label ="Toggle Focus Music " accesskey =" m " >
3636 < span id ="music-icon-container ">
3737 {{ partial "resources/Vector_Icon_Library.html" (dict "name" "music") }}
3838 </ span >
5252 const musicIcon = `{{ partial "resources/Vector_Icon_Library.html" (dict "name" "music") }}` ;
5353 const pauseIcon = `{{ partial "resources/Vector_Icon_Library.html" (dict "name" "pause") }}` ;
5454
55- musicBtn . addEventListener ( 'click' , function ( ) {
55+ const toggleMusic = ( ) => {
5656 if ( bgMusic . paused ) {
5757 bgMusic . play ( ) . then ( ( ) => {
5858 musicBtn . classList . add ( 'playing' ) ;
6565 musicBtn . classList . remove ( 'playing' ) ;
6666 iconContainer . innerHTML = musicIcon ;
6767 }
68+ } ;
69+
70+ musicBtn . addEventListener ( 'click' , toggleMusic ) ;
71+
72+ /* Keyboard Orchestration: Enabling the 'M' shortcut for focus music control. */
73+ document . addEventListener ( 'keydown' , ( e ) => {
74+ // Prevent interference with input fields
75+ if ( e . target . tagName !== 'INPUT' && e . target . tagName !== 'TEXTAREA' ) {
76+ if ( e . key . toLowerCase ( ) === 'm' ) {
77+ toggleMusic ( ) ;
78+ }
79+ }
6880 } ) ;
6981 } ) ( ) ;
7082</ script >
You can’t perform that action at this time.
0 commit comments