attempt to fix scroll
This commit is contained in:
parent
1956a7718b
commit
9e842ecfb0
|
|
@ -5120,26 +5120,12 @@ function noteApp() {
|
||||||
|
|
||||||
// Scroll selected item into view in quick switcher
|
// Scroll selected item into view in quick switcher
|
||||||
scrollQuickSwitcherIntoView() {
|
scrollQuickSwitcherIntoView() {
|
||||||
const container = document.getElementById('quickSwitcherResults');
|
this.$nextTick(() => {
|
||||||
if (!container) return;
|
const items = document.querySelectorAll('[data-quick-switcher-item]');
|
||||||
|
if (items[this.quickSwitcherIndex]) {
|
||||||
// Get all result items (skip the "no results" template)
|
items[this.quickSwitcherIndex].scrollIntoView({ block: 'nearest' });
|
||||||
const items = container.querySelectorAll('[data-quick-switcher-item]');
|
|
||||||
const selectedItem = items[this.quickSwitcherIndex];
|
|
||||||
|
|
||||||
if (selectedItem) {
|
|
||||||
// Calculate if we need to scroll
|
|
||||||
const containerRect = container.getBoundingClientRect();
|
|
||||||
const itemRect = selectedItem.getBoundingClientRect();
|
|
||||||
|
|
||||||
if (itemRect.top < containerRect.top) {
|
|
||||||
// Item is above visible area
|
|
||||||
container.scrollTop -= (containerRect.top - itemRect.top);
|
|
||||||
} else if (itemRect.bottom > containerRect.bottom) {
|
|
||||||
// Item is below visible area
|
|
||||||
container.scrollTop += (itemRect.bottom - containerRect.bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// Select note from quick switcher by click
|
// Select note from quick switcher by click
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue