Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/javascript/loading_spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ document.addEventListener('turbo:frame-render', function(event) {
if (firstResult) {
firstResult.focus();
}

// Remove the spinner now that things are ready
document.getElementById('search-results').classList.remove('spinner');

// Clear the pending action
window.pendingFocusAction = null;
};
Expand Down Expand Up @@ -53,7 +57,12 @@ document.addEventListener('click', function(event) {
// Handle pagination clicks
if (clickedElement.closest('.pagination-container') ||
clickedElement.matches('.first a, .previous a, .next a')) {
// Throw the spinner on the search results immediately
document.getElementById('search-results').classList.add('spinner');

// Position the window at the top of the results
window.scrollTo({ top: 0, behavior: 'smooth' });

window.pendingFocusAction = 'pagination';
}

Expand Down
Loading