ayoung19 / clipboard-history

A Chrome extension for managing your clipboard history securely, efficiently, and effortlessly.
https://chromewebstore.google.com/detail/clipboard-history-pro-sec/ombhfdknibjljckajldielimdjcomcek?hl=en
Apache License 2.0
23 stars 4 forks source link

fix(tags): scroll highlighted tag into view #25

Closed uussaammaahh closed 1 month ago

uussaammaahh commented 1 month ago

Fixed the following issue https://github.com/ayoung19/clipboard-history/issues/24

ayoung19 commented 1 month ago

This is awesome!!! I was pretty stumped by it because 1) I didn't know block: "nearest" was an option and 2) I was trying to solve this with refs but the good ol' querySelectorAll is just way easier here.

I believe there's technically a chance the side effect fires before the tag options finish rendering though. However, in practice this never comes up though because if matchedTags changes we call setFocusedTagIndex(0) anyway and there's always at least 1 tag option for the query selector to find.

Thanks a bunch! I love the fix.