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

Focus in modals is missing #207

Closed
rossjones opened this issue Jul 2, 2014 · 9 comments
Closed

Focus in modals is missing #207

rossjones opened this issue Jul 2, 2014 · 9 comments

Comments

@rossjones
Copy link
Contributor

Every time a modal is shown the focus is not set, which means having to maneouver the mouse around the screen to select the input.

Please make modals focus the initial input where possible (i.e. Add Patient should focus on the hospital number field so I can just type and press enter.

@davidmiller davidmiller added the bug label Jul 2, 2014
@davidmiller
Copy link
Member

This is a known issue with angular-ui/bootstrap I believe the relevant upstream ticket is angular-ui/bootstrap#1696 .

I am personally subscribed to that thread, and the relevant controllers are littered with TODO: reimplement this comments.

https://github.com/openhealthcare/opal/blob/master/opal/static/js/opal/controllers/add_episode.js#L10

It is entirely possible that one of the workarounds described in the upstream thread would work for us .

@davidmiller
Copy link
Member

This is also causing:

TypeError: Cannot read property 'find' of undefined
    at http://localhost:8000/assets/js/opal/controllers/edit_item.js:24:25
    at http://localhost:8000/assets/js/angular-1.2.11/angular.js:13593:28
    at completeOutstandingRequest (http://localhost:8000/assets/js/angular-1.2.11/angular.js:4108:10)
    at http://localhost:8000/assets/js/angular-1.2.11/angular.js:4415:7 angular.js:9419
(anonymous function) angular.js:9419
$ExceptionHandlerProvider.$get angular.js:6843
(anonymous function) angular.js:13596
completeOutstandingRequest angular.js:4108
(anonymous function)```

@davidmiller
Copy link
Member

@rossjones - I think this one is now fixed...

you should have a login to elcid-search.herokuapp.com !

@davidmiller
Copy link
Member

Pings @GabPoll @michaeledwardmarks

Modals now auto-focus on an input element again.

Deployed to elcid-search.

@davidmiller davidmiller removed their assignment Aug 6, 2014
@GabPoll
Copy link

GabPoll commented Aug 6, 2014

@davidmiller do you mean that everytime a modal opens, the cursor is waiting for you in the first box? if so, then seems fixed .

@davidmiller
Copy link
Member

davidmiller commented Aug 7, 2014

Precisely it :)

On 7 August 2014 00:37, GabPoll notifications@github.com wrote:

@davidmiller https://github.com/davidmiller do you mean that everytime
a modal opens, the cursor is waiting for you in the first box? if so, then
seems fixed .


Reply to this email directly or view it on GitHub
#207 (comment).

Love regards etc

David Miller
http://www.deadpansincerity.com
@thatdavidmiller http://twitter.com/thatdavidmiller

@michaeledwardmarks
Copy link

Agree.
Closed.

@ajmalsha
Copy link

Hi,
I'm using a conformation popup wit ok and cancel button. When the popup is shown the control is not on it. I need to control this popup using keyboard for example when i press enter the ok should work and when i press Esc the cancel should work. is this possible? If yes how?

Thanks

@davidmiller
Copy link
Member

Hi @ajmalsha

If I understand you correctly you're looking for two things:

  • Setting focus in modals
  • Hooking up keyboard events to actions in modals

Both of these are certainly possible. For keyboards you'll need to register a watch event on the handlers, for focus, you need to make sure you're firing the set focus call at the right time in the Angular digest cycle, which is not the cleanest thing in the world but there are known methods. (As far as I'm aware this is a generic problem with e.g. Angular and modals')

How are you opening your confirmation popup? Do you have an Angular controller already?
As ever, this is easier with some code to reference than abstractly, but can probably take more of a look later on.

Best David

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

5 participants