1

I am working on Web Accessibility. The expert says that when Modal popup the keyboard user should not interact out side the Modal window. I am using the Bootstrap modal. The Bootstrap version is 3. I think there is a issue regarding this on GitHub !! Here is the code snippet for the Modal.

<div class="modal fade in" id="unenrollmentWarningModal" role="dialog" aria-labelledby="myModalLabel" aria-modal="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" aria-label="Close Dialog" data-dismiss="modal">&times;</button>
                <h2 class="modal-title" id="myModalLabel">Unenrollment Warning!</h2>                    
                <div class="row">
                    <div class="col-md-6" style="text-align: center;">
                        <button class="btn btn-danger btn-block declineUnenrollment enrollButton" data-dismiss="modal">Nevermind!</button>
                    </div>
                    <div class="col-md-6" style="text-align: center;">
                        <button class="btn btn-success btn-block acceptUnenrollment enrollButton">I Understand</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

How can I resolve this issue ? Thanks.

seal
  • 1,053
  • 3
  • 19
  • 37

1 Answers1

3

If I get your question right, you need to use the tabindex="-1" attribute. See here: What's the tabindex="-1" in bootstrap for

logout
  • 591
  • 4
  • 13
  • 1
    Thanks mate :). It works if I put the `tabindex="-1"` on the modal div. Keyboard isn't focusing out side the modal window. – seal Mar 16 '18 at 11:19