CKEditor Link Input Not Working In Modal
I've got a project in which I use a modal with a form and a ckeditor and the Link input doesn't work. Here's a fiddle that recreates this problem: http://jsfiddle.net/8t882a2s/3/ A
Solution 1:
lots of answers around the internet suggested multiple ways for fixes, this worked for me, for a bootstrap 4 project:
$.fn.modal.Constructor.prototype._enforceFocus = function() {
var $modalElement = this.$element;
$(document).on('focusin.modal',function(e) {
if ($modalElement.length > 0 && $modalElement[0] !== e.target
&& !$modalElement.has(e.target).length
&& $(e.target).parentsUntil('*[role="dialog"]').length === 0) {
$modalElement.focus();
}
});
};
if your running on bootstrap 3, then override $.fn.modal.Constructor.prototype.enforceFocus
insdead.
Solution 2:
To solve this issue is enough to do the following things:
Add custom css rules on your body tag
body { --ck-z-default: 100; --ck-z-modal: calc( var(--ck-z-default) + 999 ); }
Set your modal options focus value to false
- if you are using javascript to launch modal you should do it like this:
$( '#basicModal' ).modal( { focus: false } );
- if you are using data attributes to launch modal you should have it like this
<div class="modal fade " data-focus="false" id="basicModal">
Solution 3:
That's right! For me data-focus="false" solved all issues
Solution 4:
For me, removing tabindex="-1"
from the modal attribute solves the issue.
Post a Comment for "CKEditor Link Input Not Working In Modal"