Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

feat(focus): allow to set focus when loaded or listening a scope event #728

Merged
merged 4 commits into from
Mar 9, 2015

Conversation

dimirc
Copy link
Contributor

@dimirc dimirc commented Mar 7, 2015

We could have 2 ways to set focus:

  1. Attribute autofocus to automatically get focus when loaded
  2. Attribute focus-on to define a scope event name to listen (e.g. focus-on='SomeEventName')

Demo plunker

I wanted to have this implementation on directives but to use autofocus/focus-on names could create conflict with other directives since the names will be somehow generic, so I'm just checking for these attributes and append the corresponding directives (with more specific names) if detected on compile fn.

To understand better the changes, will be cleaner to check diff without whitespaces
https://github.com/angular-ui/ui-select/pull/728/files?w=1

@kimardenmiller
Copy link

Functionality looks awesome 👍

Can't wait to have it.

@dimirc
Copy link
Contributor Author

dimirc commented Mar 9, 2015

I'm dropping the implementation via directives for now, and just adding to uiSelect link fn

New plunker demo

dimirc added a commit that referenced this pull request Mar 9, 2015
feat(focus): allow to set focus when loaded or listening a scope event
@dimirc dimirc merged commit f0908da into master Mar 9, 2015
@dimirc dimirc deleted the feat-setfocus branch March 9, 2015 00:38
@dimirc
Copy link
Contributor Author

dimirc commented Mar 9, 2015

v0.11.0 released

@dimirc dimirc mentioned this pull request Mar 9, 2015
@piernik
Copy link

piernik commented Mar 12, 2015

In multi on on-focus event it sets focus on input but not open suggestions. Can You open suggestion (as on click event)?

@kimardenmiller
Copy link

@dimirc working great. Our application has a small issue: We're not using any outline on focus:
.btn-default-focus {outline: none;}
So the user can't tell it's focused. Other fields give a blinking curser on focus, but ui-select does not.

May be the same issue as @piernik's?

Does one need to trigger an activate() to get the curser? Is it doable with your code as written?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants