Pergunta

JSBin example of issue

I'm having an issue where an action I've defined isn't being called. In the above example, everything works fine if you remove the focus-out action binding on the input. Some combination of hiding the list and the focus-out action is causing the shouldBeCalled action to never be fired.

Is there some way around this? Can I schedule the focus-out action to happen after the shouldBeCalled action in any way?

Foi útil?

Solução

It just doesn't exist, on focus out, your list disappears, and the user essentially is clicking on thin air.

You can see this by doing a long click, key-down causes focus out, and your list disappears, and key-up fires clicks the action, but oh no, it's gone!!!

You're stuck in a good conundrum, the best way to handle and be responsive is to consider focus-out on an entire area (including your list of items) and not just out of the input box. But to answer your question, sure you can schedule it, but it's generally hacky (gotta make it last long enough for the click, but not too long that it looks unresponsive)

var self = this;
Em.run.later(function(){
  self.set('listVisible', false);  
}, 240);

http://emberjs.jsbin.com/mohawidu/4/edit

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top