1

http://jsfiddle.net/h3WDq/1921/

I can't type in textarea, when the modal is opened.

Textarea is not in modal and has absolute positioning with large z-index.

<textarea style='position:absolute;z-index:200000'></textarea>

Can anyone override this problem?

Sonya Seyrios
  • 83
  • 1
  • 9

4 Answers4

2

Remove tabindex="-1" from <div id="myModal1" class="modal hide" tabindex="-1" role="dialog"> and will work. Don't understand why tabindex is creating this problem.

AG_
  • 2,589
  • 3
  • 20
  • 32
2

It looks this line of code is the problem where Bootstrap enforces focus each time you show the modal. So let's remove the event each time:

$('#myModal1').on('shown.bs.modal', function (e) {
  $(document).off('focusin.modal');
})

See fiddle.

prograhammer
  • 20,132
  • 13
  • 91
  • 118
1

In case anyone is using Bootstrap Vue and seeing this same issue:

Bootstrap Vue provides a b-modal property named "ignore-enforce-focus-selector". You can use this property to provide a selector (including a comma-separated selector list) that specifies elements that can be focused even while the modal is visible. In my case, I had a number of textarea elements that needed to be focusable while the modal was visible. Setting "ignore-enforce-focus-selector" to "textarea" made it possible to edit these textareas while the modal was visible.

See https://bootstrap-vue.org/docs/components/modal#keyboard-navigation

John
  • 11
  • 1
0
<textarea style='position:absolute;z-index:200000' autofocus></textarea>
Aravind
  • 40,391
  • 16
  • 91
  • 110
  • Did you check it in my Fiddle? Your answer has no sense and doesn't work. – Sonya Seyrios Mar 10 '17 at 07:13
  • While this code snippet may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – g00glen00b Mar 10 '17 at 07:43
  • Its because I posted answer from mobile app, screen size is limited. Will keep in mind in future. – Aravind Mar 10 '17 at 09:12
  • @SonyaSeyrios this answer helped you ? – Aravind Mar 10 '17 at 09:21