Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go To Highlighted Deck in Overall List Of Decks #3632

Open
dae opened this issue Dec 13, 2024 · 2 comments
Open

Go To Highlighted Deck in Overall List Of Decks #3632

dae opened this issue Dec 13, 2024 · 2 comments

Comments

@dae
Copy link
Member

dae commented Dec 13, 2024

It would be nice to skip to the last used deck / highlighted deck when going back to the list of decks instead of starting up at the top and scrolling all the way to it. Thank you for the consideration!

Originally reported on https://forums.ankiweb.net/t/go-to-highlighted-deck-in-overall-list-of-decks/52966

@iamllama
Copy link
Contributor

Could be done with the following perhaps, (as long as the tree is expanded such that the current deck is visible)

diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py
index a3969cedf..2b4eb7940 100644
--- a/qt/aqt/deckbrowser.py
+++ b/qt/aqt/deckbrowser.py
@@ -199,6 +199,9 @@ class DeckBrowser:
         self._drawButtons()
         if offset is not None:
             self._scrollToOffset(offset)
+        else:
+            # scroll to current deck
+            self.web.eval("document.querySelector('.deck.current')?.scrollIntoView({ behavior: 'smooth', block: 'center' });")
         gui_hooks.deck_browser_did_render(self)
 
     def _scrollToOffset(self, offset: int) -> None:

but then again since a hook is already available it might be best left to an addon instead

@brishtibheja
Copy link
Contributor

Seems like a very basic feature that doesn't warrant an add-on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants