We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 148a43b commit c8e0dd9Copy full SHA for c8e0dd9
src/gui/app/directives/modals/overlay/add-or-edit-overlay-widget-modal.js
@@ -299,9 +299,24 @@
299
true
300
);
301
302
+ $ctrl.scrollToFirstInvalidField = () => {
303
+ const invalidField = document.querySelector('.modal-body .ng-invalid[name]:not(form)');
304
+ if (invalidField) {
305
+ invalidField.scrollIntoView({ behavior: 'smooth', block: 'center' });
306
+
307
+ // Focus the field if it's focusable
308
+ setTimeout(() => {
309
+ if (invalidField.focus) {
310
+ invalidField.focus();
311
+ }
312
+ }, 300);
313
314
+ };
315
316
$ctrl.save = () => {
317
$scope.widgetSettings.$setSubmitted();
318
if ($scope.widgetSettings.$invalid) {
319
+ $ctrl.scrollToFirstInvalidField();
320
return;
321
}
322
0 commit comments