Use afterRender hook instead of didInsertElement.