mirror of
https://github.com/vinta/awesome-python.git
synced 2026-03-23 05:03:45 +08:00
fix: back-to-top button scrolls to search input and focuses it
When results are visible, clicking the button previously scrolled to the results section. It now targets the search input instead, scrolls it into view centered, and focuses it so the user can immediately type a new query. Button label updated from 'Top' to 'Search' to reflect the new destination. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -351,8 +351,10 @@ if (backToTop) {
|
||||
window.addEventListener('resize', updateBackToTopVisibility);
|
||||
|
||||
backToTop.addEventListener('click', function () {
|
||||
if (!resultsSection) return;
|
||||
resultsSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
var target = searchInput || resultsSection;
|
||||
if (!target) return;
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
if (searchInput) searchInput.focus();
|
||||
});
|
||||
|
||||
updateBackToTopVisibility();
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
<th class="col-commit" data-sort="commit-time">Last Commit</th>
|
||||
<th class="col-cat">Tags</th>
|
||||
<th class="col-arrow">
|
||||
<button class="back-to-top" aria-label="Back to library index">
|
||||
Top
|
||||
<button class="back-to-top" aria-label="Back to search">
|
||||
Search
|
||||
</button>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user