feat: TaskDetail as script setup (#1792)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1792 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:

committed by
konrad

parent
1d7f857070
commit
2dc36c032b
19
src/helpers/scrollIntoView.ts
Normal file
19
src/helpers/scrollIntoView.ts
Normal file
@ -0,0 +1,19 @@
|
||||
export function scrollIntoView(el: HTMLElement | null | undefined) {
|
||||
if (!el) {
|
||||
return
|
||||
}
|
||||
|
||||
const boundingRect = el.getBoundingClientRect()
|
||||
const scrollY = window.scrollY
|
||||
|
||||
if (
|
||||
boundingRect.top > (scrollY + window.innerHeight) ||
|
||||
boundingRect.top < scrollY
|
||||
) {
|
||||
el.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'nearest',
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user