mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Smoothing scroll of edit modal.
This commit is contained in:
parent
fe5a1c44a1
commit
cff0c20007
2 changed files with 10 additions and 2 deletions
|
|
@ -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 () => {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue