Skip to content

Commit

Permalink
js: Fix error on app startup
Browse files Browse the repository at this point in the history
jQuery seems to re-cycle event object references oO
  • Loading branch information
nilmerg committed Aug 7, 2024
1 parent 97f8767 commit 9ef4c71
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions public/js/icinga/behavior/autofocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
Autofocus.prototype = new Icinga.EventListener();

Autofocus.prototype.onRendered = function(e) {
setTimeout(function() {
if (document.activeElement === e.target
const _this = e.data.self;
const target = e.target;
setTimeout(() => {
if (document.activeElement === target
|| document.activeElement === document.body
) {
e.data.self.icinga.ui.focusElement($(e.target).find('.autofocus'));
_this.icinga.ui.focusElement($(target).find('.autofocus'));
}
}, 0);
};
Expand Down

0 comments on commit 9ef4c71

Please sign in to comment.