Make modals scroll to top when opened

This commit is contained in:
Robbie Antenesse 2020-08-03 16:33:56 -06:00
parent 5a728dbd7c
commit b61f128745
3 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,6 @@ import { addWord, sortWords } from "./wordManagement";
import { migrateDictionary } from './migration';
export function updateDictionary () {
renderDictionaryDetails();
}
@ -49,6 +48,7 @@ export function openEditModal() {
}
document.getElementById('editModal').style.display = '';
Array.from(document.querySelectorAll('#editModal .modal-content section')).forEach(section => section.scrollTop = 0);
}
export function saveEditModal() {

View File

@ -30,6 +30,7 @@ export function openSettingsModal() {
showTemplateEditor(false);
document.getElementById('settingsModal').style.display = '';
document.querySelector('#settingsModal .modal-content section').scrollTop = 0;
}
export function updateTemplateSelects() {

View File

@ -35,7 +35,9 @@ function setupEditFormTabs() {
document.getElementById('edit' + t.innerText + 'Tab').style.display = 'none';
});
tab.classList.add('active');
document.getElementById('edit' + tab.innerText + 'Tab').style.display = '';
const tabSection = document.getElementById('edit' + tab.innerText + 'Tab');
tabSection.style.display = '';
tabSection.scrollTop = 0;
});
});
}