looks for autofocus fields and applies focus #480

wants to merge 1 commit into


None yet

1 participant


This change adds a minor piece of functionality to set focus on a field in the modal set as autofocus. This overrides the behaviour of setting .btn-primary:first to focused.

I tried to add a test for this functionality as follows but couldn't get it to work:

describe("", function () {
        it("applies focus to form element specifying autocomplete attribute", function (done) {

          var spy = sinon.spy($.fn, 'focus');

          var box = bootbox.dialog({
            message: "<input type=\"text\" class=\"focusTest\" autofocus />"

          box.bind('', function () {
              var el = box.find("[autofocus]").get(0);


Happy to go back and add tests if this is just my lack of understanding how sinon works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment