This package has been deprecated

Author message:

repo moved to @zestia/ember-auto-focus

ember-auto-focus

2.0.4 • Public • Published

ember-auto-focus

       

HTML's autofocus attribute focuses an element on page load.

However, in single page apps the page load event only happens once - so autofocus pretty much becomes useless.

Example

When the auto-focus element is inserted, it will attempt to focus the first child contained within it:

{{#if showField}}
  {{#auto-focus}}
    <input>
  {{/auto-focus}}
{{/if}}

Alternatively, you can pass in a selector:

{{#auto-focus '.my-child'}}
  <div class="my-child" tabindex=0></div>
{{/auto-focus}}

You can set the disabled attribute to true to prevent autofocusing:

{{#auto-focus disabled=shouldAutoFocus}}
   ...
{{/auto-focus}}

Installation

ember install ember-auto-focus

Package Sidebar

Install

npm i ember-auto-focus

Weekly Downloads

24

Version

2.0.4

License

MIT

Last publish

Collaborators

  • amk221