Enhance keyboard navigation in /bets/new pages

- After digits+Enter to select match, scroll to the match panel
- When TAB navigates to outcomes, focus goes directly to input field
- ESC key closes match panel without requiring Enter, allowing selection of another match
- Applied changes to both cashier and admin new bet pages
parent 9636b502
......@@ -302,6 +302,8 @@ function selectMatchByNumber(matchNumber) {
if (matchNumMatch && parseInt(matchNumMatch[1]) === matchNumber) {
// Open this match
openMatch(card, matchId);
// Scroll to the match panel
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
return;
}
}
......@@ -378,6 +380,13 @@ function navigateOutcomes() {
currentOutcome.style.border = '3px solid #0d6efd';
currentOutcome.style.boxShadow = '0 0 0 0.2rem rgba(13, 110, 253, 0.25)';
// Focus on the input field within the outcome card
const amountInput = currentOutcome.querySelector('.amount-input');
if (amountInput) {
amountInput.focus();
amountInput.select(); // Select all text for easy replacement
}
// Scroll into view
currentOutcome.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
......
......@@ -302,6 +302,8 @@ function selectMatchByNumber(matchNumber) {
if (matchNumMatch && parseInt(matchNumMatch[1]) === matchNumber) {
// Open this match
openMatch(card, matchId);
// Scroll to the match panel
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
return;
}
}
......@@ -378,6 +380,13 @@ function navigateOutcomes() {
currentOutcome.style.border = '3px solid #0d6efd';
currentOutcome.style.boxShadow = '0 0 0 0.2rem rgba(13, 110, 253, 0.25)';
// Focus on the input field within the outcome card
const amountInput = currentOutcome.querySelector('.amount-input');
if (amountInput) {
amountInput.focus();
amountInput.select(); // Select all text for easy replacement
}
// Scroll into view
currentOutcome.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment