Skip to content

Commit c40e22a

Browse files
committed
improve keyboard shortcut detection after using panel controls
1 parent 6b61674 commit c40e22a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ async function fullscreen() {
17191719
if ( isPIP() )
17201720
await document.exitPictureInPicture();
17211721
audioMotion.toggleFullscreen();
1722-
document.activeElement.blur(); // move keyboard focus to the document body
1722+
document.activeElement.blur(); // move focus to the document body, so keyboard shortcuts are properly detected
17231723
}
17241724

17251725
/**
@@ -4212,7 +4212,10 @@ function setUIEventListeners() {
42124212
elContainer.addEventListener( 'mouseleave', () => clearTimeout( autoHideTimeout ) );
42134213

42144214
// toggle front panel button (expand/collapse)
4215-
elTogglePanel.addEventListener( 'click', () => toggleFrontPanel() );
4215+
elTogglePanel.addEventListener( 'click', () => {
4216+
toggleFrontPanel();
4217+
elTogglePanel.blur(); // remove focus from element, so it doesn't interfere with keyboard shortcuts
4218+
});
42164219

42174220
// wait for the transition on the analyzer container to end (triggered by the height change from toggleFrontPanel())
42184221
elContainer.addEventListener( 'transitionend', () => {
@@ -4282,6 +4285,7 @@ function setUIEventListeners() {
42824285
}
42834286
setProperty( el );
42844287
updateRangeValue( el );
4288+
el.blur(); // remove focus from element, so it doesn't interfere with keyboard shortcuts
42854289
});
42864290
}
42874291
});
@@ -4332,6 +4336,7 @@ function setUIEventListeners() {
43324336
return;
43334337
}
43344338
audioEl.currentTime = duration * elSongProgress.value;
4339+
elSongProgress.blur(); // remove focus from element, so it doesn't interfere with keyboard shortcuts
43354340
});
43364341

43374342
// load / save presets

0 commit comments

Comments
 (0)