wekan/client/lib/autofocus.js

14 lines
405 B
JavaScript
Raw Normal View History

2026-01-21 20:03:40 +02:00
// Native replacement for mquandalle:autofocus package
// Handles autofocus attribute in dynamically rendered Blaze templates
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
2026-01-24 02:38:25 +02:00
Template.body.onRendered(function() {
2026-01-21 20:03:40 +02:00
Tracker.afterFlush(() => {
const el = this.find('[autofocus]');
if (el && typeof el.focus === 'function') {
el.focus();
}
});
});