Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move cursor to username text box when logging in #196

Open
LongArmMcGee opened this issue Dec 10, 2015 · 5 comments
Open

Move cursor to username text box when logging in #196

LongArmMcGee opened this issue Dec 10, 2015 · 5 comments
Assignees
Milestone

Comments

@LongArmMcGee
Copy link
Member

When clicking the log in button, the cursor should jump to the username text field so that the user can immediately start typing their username.

@Mctalian Mctalian added this to the MVP milestone Dec 11, 2015
@LongArmMcGee
Copy link
Member Author

@YashdalfTheGray @Mctalian My solution to this works for the login dialogue! Yay! Unfortunately, it doesn't work for the comments/backs tabs. I'm guessing because those cards are hidden behind nf-ifs instead of being loaded as new pages? I got my solution from this SO answer. Maybe we could run a bit of code to set focus on those input fields when those ng-ifs evaluate true?

Pull down my master and let me know what you think plz!

@LongArmMcGee
Copy link
Member Author

Tag anyone else you think would be interested, i always try to limit tags so as not to spam... but we all starred the repo for notifications anyway!

@LongArmMcGee LongArmMcGee self-assigned this Dec 12, 2015
@Mctalian
Copy link
Member

I think I might have a potential solution to this... I'm pulling down your changes now to try to diagnose what's going on

@Mctalian
Copy link
Member

So it does work, kind of... if you login and then navigate to the idea that you're the author of, or on the team, the update text field will get focused. So I don't think it's an ng-if evaluation problem, the problem is it gets evaluated once and only once. We need a way to trigger it on demand if we need to.

I have something working over here, it adds an isolated scope to the autoFocus directive allowing us to pass in an expression. We can then leverage md-on-select and md-on-deselect for the md-tab. On select of the Updates tab for example, we could set some flag, updatesSelected = true, and on deselect set it false.

In the link function of the directive, we watch for any changes of the value that's being passed in using _scope.$watch and we trigger your timeout if the value has changed, and the value is true or typeof whateverYourValueIsCalled === 'undefined' just in case we don't need to pass in an expression (like the login form). The timeout had to be adjusted to 150ms due to the animation timers, but we might be able to shorten it a bit if needed.

It works for Updates tab, Comments tab, editing idea, adding new idea, login screen.

Let me know if you want to work on this at some point or need some guidance.

@LongArmMcGee
Copy link
Member Author

I'll need help. I got close on my own but didn't see the right behavior. Bob will help me this week.

@davethenipper davethenipper modified the milestones: Phase 2, MVP Feb 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants