2.0.4 • Published 6 years ago

ember-auto-focus v2.0.4

Weekly downloads
138
License
MIT
Repository
github
Last release
6 years ago

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
2.0.4

6 years ago

2.0.2

6 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago