1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Scroll the highlighted element into view

This commit is contained in:
Andrew Kingston 2022-06-14 14:32:17 +01:00
parent 40018e9332
commit 7ec1b02c99

View file

@ -192,6 +192,16 @@
}
} else if (type === "highlight-setting") {
store.actions.settings.highlight(data.setting)
// Also scroll setting into view
const selector = `[data-cy="${data.setting}-prop-control"`
const element = document.querySelector(selector)?.parentElement
if (element) {
element.scrollIntoView({
behavior: "smooth",
block: "center",
})
}
} else {
console.warn(`Client sent unknown event type: ${type}`)
}