Giter VIP home page Giter VIP logo

Comments (3)

maxedmands avatar maxedmands commented on July 30, 2024

Hey!

I've run into this problem too. It's kind of a bummer.

After a brief look at the problem, it seems that most browsers will only allow javascript to set focus on an element as a result of a direct user action. (This means that the focus needs to be set in the same iteration of the event loop as the original click, instead of in a timeout or after an animation, which is how most modals work.)

If anyone has a solution to this problem, suggestions or pull requests are enthusiastically accepted.

from ng-focus-on.

agungsb avatar agungsb commented on July 30, 2024

I'm using ngDialog and faced the same problem. But I managed to solve the problem by making a directive and call the service inside the directive's controller. In my case, I open my dialog by using myDialog directive as follows:

ngDialog.open({
    template: '<my-dialog></my-dialog>', 
    plain: true
});

You see that I don't call the service inside the modal's controller. I call the service inside the directive's controller instead.

Well this is not really a solution. But I hope this would be an alternative solution for people who are facing the same issue.

from ng-focus-on.

mirague avatar mirague commented on July 30, 2024

I'm facing the same issue, what's the reason it works with a $timeout of 0ms but not without?

from ng-focus-on.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.