This code only seems to work as the developers have intended in Internet Explorer, because in Chrome the focus stays on the input field in the Qlik Sense Listbox, but in IE the focus is returned to the Bootstrap Modal element.
This is all happening because the Listbox popover is dynamically added to the DOM in the Body element and not inside the Bootstrap Modal element. This is a very common solution to avoid other types of problems. And therefore there a lot of other libraries/UI-projects that have the same problem described above.
The good thing is that there is a very easy way to solve it and that is to override the enforceFocus function (that only works in IE anyways). It’s done with the following line: