fix(dashboard): keep keyboard focus on the Usage table's Show more/less

The table redraws without the button that was pressed, so focus fell back
to the page and the next Tab started from the top. Focus now moves to the
button that replaces it, as the sort headers already do.
This commit is contained in:
Nariman Jelveh committed 2026-10-23 14:24:18 -07:00
1 parent eef34ce4c8
commit baecb7ba8f
1 file changed
+5 -1
+5 -1
View File
@@ -124,16 +124,20 @@ const TabUsage = {
$($el_window).find(`.driver-usage-details-content-table th[data-sort="${column}"] .usage-sort-btn`).trigger('focus');
});
// Click handler for "Show more" to expand the table
// Click handler for "Show more" to expand the table. The redrawn
// table has no clicked button; focus moves to the one replacing it
// (here and below), not to the top of the page.
$($el_window).on('click', '.usage-table-show-more', function () {
usageTableExpanded = true;
renderUsageTable();
$($el_window).find('.usage-table-show-less').trigger('focus');
});
// Click handler for "Show less" to collapse the table
$($el_window).on('click', '.usage-table-show-less', function () {
usageTableExpanded = false;
renderUsageTable();
$($el_window).find('.usage-table-show-more').trigger('focus');
});
},
// Refresh whenever the tab is (re)activated — otherwise the usage numbers