Skip to content

Commit 0b5d927

Browse files
Move focus to first card after tenant selection
- Focus tenant input only when no tenant is selected - After selecting a tenant, focus moves to first machine card - Improves keyboard navigation and user flow Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent a3c962e commit 0b5d927

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dashboard/src/pages/index.astro

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ const apiBaseUrl = import.meta.env.PUBLIC_API_BASE_URL || 'https://api.tgit.app'
210210
else if (count <= 6) cardWidth = '380px';
211211
else cardWidth = '350px';
212212
cards.forEach(c => c.style.width = cardWidth);
213+
214+
// Focus first card if tenant was selected
215+
const params = new URLSearchParams(window.location.search);
216+
const tenant = params.get('tenant');
217+
if (tenant && tenant !== 'default' && cards.length > 0) {
218+
cards[0].tabIndex = 0;
219+
cards[0].focus();
220+
}
213221
}
214222
} catch (error) {
215223
console.error('Error fetching users:', error);
@@ -236,8 +244,10 @@ const apiBaseUrl = import.meta.env.PUBLIC_API_BASE_URL || 'https://api.tgit.app'
236244
tenantInput.value = urlTenant;
237245
}
238246

239-
// Auto-focus on tenant input when page loads
240-
tenantInput?.focus();
247+
// Auto-focus on tenant input when page loads (only if no tenant selected)
248+
if (!urlTenant || urlTenant === 'default') {
249+
tenantInput?.focus();
250+
}
241251

242252
function goToTenant() {
243253
const tenant = tenantInput?.value.trim().toLowerCase() || 'default';

0 commit comments

Comments
 (0)