TAB key navigate only in MODAL

2

Good morning, people,

I need to make the TAB key navigate only in modal, an example is Twitter that when the Modal message is open or any other, we can not navigate the screen behind through the TAB, someone has an idea of how it is done ?

    
asked by anonymous 01.12.2015 / 13:06

1 answer

2

You can use the tabindex="- 1" property

<div class="modal fade" id="modal" tabindex="-1">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button hidden="hidden" type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

            </div>
            <div class="modal-body">
                modal texto
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-
    
01.12.2015 / 14:12