3

I am working on 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?

TylerH
  • 20,799
  • 66
  • 75
  • 101
seal
  • 1,122
  • 5
  • 19
  • 37
  • Does this answer your question? [What's the tabindex="-1" in bootstrap for](https://stackoverflow.com/questions/32911355/whats-the-tabindex-1-in-bootstrap-for) – TylerH Nov 23 '22 at 14:39
  • @TylerH yes. it does. – seal Nov 25 '22 at 07:44

1 Answers1

4

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
  • 621
  • 5
  • 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