mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: Focus player on page load for immediate keyboard control
This commit is contained in:
parent
2ebdd689ab
commit
116f44cade
1 changed files with 20 additions and 0 deletions
|
@ -107,6 +107,26 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Focus on the player element so keyboard shortcuts work immediately
|
||||||
|
setTimeout(() => {
|
||||||
|
// Use setTimeout to ensure the player is fully initialized
|
||||||
|
if (player && typeof player.focus === 'function') {
|
||||||
|
player.focus();
|
||||||
|
} else {
|
||||||
|
// If player doesn't have a focus method, try to find and focus the terminal element
|
||||||
|
const playerElement = document.querySelector('.asciinema-terminal');
|
||||||
|
if (playerElement) {
|
||||||
|
playerElement.focus();
|
||||||
|
} else {
|
||||||
|
// Last resort - try to find element with tabindex
|
||||||
|
const tabbableElement = document.querySelector('[tabindex]');
|
||||||
|
if (tabbableElement) {
|
||||||
|
tabbableElement.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
|
||||||
// Function to display toast notification
|
// Function to display toast notification
|
||||||
function showToast(text) {
|
function showToast(text) {
|
||||||
// Get the appropriate container based on fullscreen state
|
// Get the appropriate container based on fullscreen state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue