How can I make a soft keyboard using autoload modally with auto focus of the field? It sounds simple, but I canβt do it yet.
Part of the focus works, but not the keyboard.
I am trying to save a user by clicking.
I can use the '.bs.modal shown' and set the focus, but the soft keyboard will not be displayed automatically. The user still needs to reassign the field. How can I make the screen panel fit.
The code I'm playing in now (to a large extent):
this.$container.on('shown.bs.modal', function () { console.log('shown.bs.modal'); setTimeout(function () { var $ctrl = $(jqselector); $ctrl.addClass('active').focus(); }, 500); }); this.$container.modal({ backdrop: (this.config.showModal ? 'static' : true) }) .on('hidden.bs.modal', function () { $(this).remove(); });
Focus Question Only
one more question
Edit: Having looked at the bootstrap code several times, it looks like the ad is completely tied to modal management after all processing. I assumed this was happening, and so I added setTimeout, but even with a long delay, no luck. This weekend I will look a little more bot-glancing code.
Bounty edit: Bootstrap Code:
Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.checkScrollbar() this.$body.addClass('modal-open') this.setScrollbar() this.escape() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(that.$body)
I played with the code during the show and showed special modal events. The code looks something like this.
setTimeout(function (e) { $(':focus').trigger('blur'); $(document).off('focusin.bs.modal'); var $ctrl = $(jqSelect); $ctrl.trigger('focus'); $ctrl.trigger('click'); }, 750);