Focus contextbutton after update if focused beforehand

Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
Fernando 2020-07-01 13:22:56 +02:00 committed by GitHub
parent 5626380d7f
commit 21b17e8097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,9 +178,13 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
let contextButton = context.querySelector('.btnToggleContextMenu');
// We remove the previous event listener by replacing the item in each update event
const autoFocusContextButton = document.activeElement === contextButton;
let contextButtonClone = contextButton.cloneNode(true);
contextButton.parentNode.replaceChild(contextButtonClone, contextButton);
contextButton = context.querySelector('.btnToggleContextMenu');
if (autoFocusContextButton) {
contextButton.focus();
}
var options = {
play: false,
queue: false,