mirror of
https://github.com/wekan/wekan.git
synced 2026-01-24 10:16:09 +01:00
13 lines
405 B
JavaScript
13 lines
405 B
JavaScript
// Native replacement for mquandalle:autofocus package
|
|
// Handles autofocus attribute in dynamically rendered Blaze templates
|
|
import { Template } from 'meteor/templating';
|
|
import { Tracker } from 'meteor/tracker';
|
|
|
|
Template.body.onRendered(function() {
|
|
Tracker.afterFlush(() => {
|
|
const el = this.find('[autofocus]');
|
|
if (el && typeof el.focus === 'function') {
|
|
el.focus();
|
|
}
|
|
});
|
|
});
|