Giter Site home page Giter Site logo

Comments (5)

nikku avatar nikku commented on August 29, 2024

Hmm, it actually worked as you described.
Seems to be a bug :-).

from jquery-bootstrap-scripting.

JoshZA avatar JoshZA commented on August 29, 2024

I changed line 109 to

var focusable = dialog.find("a, input:not([type=hidden]), .btn, select, textarea, button")

and now it works as intended :)

from jquery-bootstrap-scripting.

syphernl avatar syphernl commented on August 29, 2024

The system still falsely puts its focus on normal hyperlinks, rather than just the buttons.

from jquery-bootstrap-scripting.

nikku avatar nikku commented on August 29, 2024

That is actually intended. The reason is that you can tab through the content to the first button (try it!).
The behaviour on dialog focus is consistent with the behavior of a page load (will focus the first element on the page, too).

You can patch the lib yourself if you want to (will check if i can provide you a patch for that).

from jquery-bootstrap-scripting.

nikku avatar nikku commented on August 29, 2024

I am still not 100% sure what your desired behavior is. Whatever you would like to achieve, you can always register a event listener on the dialog which will perform a custom initialization on content load.

var dialog = $(".my-dialog").dialog2();
dialog.bind("dialog2.content-update", function(event) {
    var focusable = $(this).parent().find(".modal-footer").find("input[type=submit], input[type=button], .btn, button");
    if (focusable.length) {
        focusable = focusable.eq(0);
    }

    focusable.focus();
});

This works for the 1.2-wip branch of the dialog2 plugin. For older versions of it, use the event dialog2.ajax-complete trigger. Hope this helps!

from jquery-bootstrap-scripting.

Related Issues (20)

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.