zestia / ember-select-box

:capital_abcd: A faux select box for Ember apps
MIT License
64 stars 14 forks source link

Support `autofocus` Attribute for {{select-box.native}}? #10

Closed nadnoslen closed 7 years ago

nadnoslen commented 7 years ago

Hey Andrew, Still absolutely loving this component...

Just bumped into a situation where I wanted to take advantage of a select box's autofocus attribute. Currently, we don't have that bound to the select-box.native.

Worked around once again by placing the following in my app/app.js

import EmberSelectBoxNative from 'ember-select-box/components/select-box/native';
EmberSelectBoxNative.reopen({
  attributeBindings: ['autofocus']
});

I can put a PR together for an official fix if you'd like.

Looking at your source I think you've taken care of most other required attributes: http://www.w3schools.com/tags/tag_select.asp

amk221 commented 7 years ago

Hi, thanks, no problem I'll sort that out tomorrow.

I have personally found myself having to use ember-auto-focus simply because the autofocus attribute will only work once anyway, making it pretty much useless.

But you're right it still needs adding. Cheers

nadnoslen commented 7 years ago

Yeah, I've actually created a mixin that fixes that autofocus stupidity myself:

https://github.com/cybertoothca/ember-cli-textarea-autosize#trigger-focus-mixin