Skip to content

Commit

Permalink
исправлена работа кнопки "Где ошибка?" в модальном окне (ЛНД).
Browse files Browse the repository at this point in the history
  • Loading branch information
markovpw committed Dec 4, 2024
1 parent bedf974 commit 0c74727
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,18 @@ export const pre = function (individual, template, container, mode, extra) {
});
//find error button
template[0].querySelector('#findError').addEventListener('click', function () {
const mainContainer = document.querySelector('#main');
const errorElement = $('.has-error', mainContainer)[0];
const modalContainer = $('.modal.in')[0];
const container = modalContainer || document.querySelector('#main');
const errorElement = $('.has-error', container)[0];

if (errorElement && window.getComputedStyle(errorElement).visibility == 'hidden') {
errorElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
$(errorElement).popover('show');
} else {
const hiddenErrorSection = $('.section-with-error', mainContainer)[0];
const hiddenErrorSection = $('.section-with-error', container)[0];
if (hiddenErrorSection) {
hiddenErrorSection.dispatchEvent(new Event('showRequest'));
const ErrorElement = $('.has-error', mainContainer)[0];
const ErrorElement = $('.has-error', container)[0];
if (ErrorElement) {
ErrorElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
$(ErrorElement).popover('show');
Expand Down

0 comments on commit 0c74727

Please sign in to comment.