Smoothing scroll of edit modal.

This commit is contained in:
Roland 2023-05-03 09:01:25 -06:00
parent fe5a1c44a1
commit cff0c20007
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 10 additions and 2 deletions

View file

@ -15,7 +15,7 @@ import {
TableHeaderCell,
TableRow,
} from "semantic-ui-react";
import {contrastingColor} from "./components/Common";
import {contrastingColor, scrollToTopOfElement} from "./components/Common";
import {
Button,
FormInput,
@ -200,7 +200,8 @@ function EditTagsModal() {
setTagColor(color || DEFAULT_TAG_COLOR);
setTagId(id);
// Scroll to top of Edit Modal.
document.getElementById('editModalContent').scrollTop = 0;
const editModalContent = document.getElementById('editModalContent');
scrollToTopOfElement(editModalContent);
}
const localSaveTag = async () => {

View file

@ -359,6 +359,13 @@ export function scrollToTop() {
});
}
export function scrollToTopOfElement(element, smooth=true) {
element.scroll({
top: 0,
behavior: smooth ? 'smooth' : 'auto',
});
}
export function SearchInput({
searchStr,
onSubmit,