You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is only a bug tested in IE 9 and 10. The bug is not produced in Firefox or Chrome. Also note that this bug in ONLY reproduced in modals. This method works for selecting text when not in a modal window.
I am programmatically selecting text from a div in a modal. The focus event in Bootstrap 2.3.1 on line 907 (shown below) conflicts with the selecting of text.
enforceFocus: function () {
var that = this
$(document).on('focusin.modal', function (e) {
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
that.$element.focus()
}
})
}
$('.textSelector').click(function(){
var text = $(this).siblings().find("table").parent()[0];
var range;
if(document.body.createTextRange){ //ms
range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
}else if(window.getSelection){ //all others
var selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
});
I have isolated the issue in the bootstrap source on line 907 (as mentioned above) and have added a bandage fix to my code above, at the top of the click event:
$(document).off("focusin.modal");
The text was updated successfully, but these errors were encountered:
Sorry this focus trap is for accessibility reasons. To get around this for your case you could just set the enforce focus method to a noop. Allthough people with screen readers will be pretty confused when trying to use modals in your application
This is only a bug tested in IE 9 and 10. The bug is not produced in Firefox or Chrome. Also note that this bug in ONLY reproduced in modals. This method works for selecting text when not in a modal window.
I am programmatically selecting text from a div in a modal. The focus event in Bootstrap
2.3.1 on line 907 (shown below)conflicts with the selecting of text.Below is code to duplicate the issue only in IE.
HTML
The JavaScript to simulate selecting the text:
I have isolated the issue in the bootstrap source on line 907 (as mentioned above) and have added a bandage fix to my code above, at the top of the click event:
The text was updated successfully, but these errors were encountered: