Skip to content

Commit 65fe71e

Browse files
Restore explicit control of spinner
1 parent b261749 commit 65fe71e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/assets/stylesheets/partials/_loading_spinner.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
// Pagination overlay when loading
11-
[busy]:not([no-spinner]) {
11+
.spinner {
1212
position: relative;
1313
min-height: 400px;
1414
display: block;

app/javascript/loading_spinner.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ document.addEventListener('turbo:frame-render', function(event) {
3939
// console.log(`Updated tab input value to: ${queryParam}`);
4040
}
4141

42+
// Remove the spinner now that things are ready
43+
document.getElementById('search-results').classList.remove('spinner');
44+
4245
// Clear the pending action
4346
window.pendingFocusAction = null;
4447
};
@@ -59,6 +62,10 @@ document.addEventListener('click', function(event) {
5962
const clickedParams = new URLSearchParams(clickedElement.search);
6063
const newTab = clickedParams.get('tab');
6164

65+
// Throw the spinner on the search results immediately
66+
document.getElementById('search-results').classList.add('spinner');
67+
68+
// Position the window at the top of the results
6269
window.scrollTo({ top: 0, behavior: 'smooth' });
6370

6471
swapTabs(newTab);

0 commit comments

Comments
 (0)