Fix issues with modals

Fixes issues with a select inside a modal with a data-container set to
something outside of the modal (such as body).

Close #324
#427?