-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clipboard.js won't copy text from modal with negative tabindex value #388
Comments
I have faced exactly with this problem. I am using dialog of blueprintjs which has two wrapper div elements with tabIndex attribute. When I remove these attributes manually clipboard library works. |
Hey @Kolpikov, Bootstrap's modal enforce focus for accessibility reasons but that causes problems with LOTS of third-party libraries, including clipboard.js. You can turn off this functionality by doing... Bootstrap 3 $.fn.modal.Constructor.prototype.enforceFocus = function() {}; Bootstrap 4 $.fn.modal.Constructor.prototype._enforceFocus = function() {}; If you want to know exactly what you're overriding, check the
|
Also check the new |
@zenorocha , How would I use this in react? It doesn't seem to recognize 'new' and won't work with var. |
Any ideas how to copy text to clipboard in a modal with negative tab index using Bootstrap 5? |
Maybe this can help, I tried to copy clipboard in modal Bootstrap 5 by doing this: example of element: the jquery:
|
Minimal example
Expected behaviour
I faced problem while trying to copy text from modal window. Library won't copy any text inside modal that has negative tabindex value. I created a small example in which I reproduce this issue.
First modal form doesn't have tabindex attribue and library works as a charm, but for the second one - I added
tabindex="-1"
attribue and library faild to copy (but whithout any errors shown).Hope this will be usefull for you and you will include this issue into your documentation. :)
The text was updated successfully, but these errors were encountered: