When a modal window 1st control does not have a tabindex by default, background controls can be focused when using tab to navigate between controls.(any control rendered with <span> or <a> elements such as toolbar buttons).
Reproduced with
<zk>
<style>
.z-toolbarbutton:focus, .z-button:focus, .z-toolbar:focus {
background-color: yellow;
border: 1px red solid;
}
</style>
<button></button>
<button></button>
<window mode="modal">
<toolbar>
<toolbarbutton label="toolbarbutton"></toolbarbutton>
<!-- <toolbarbutton xmlns:w="client" w:onBind="this.$n().tabIndex = 0" label="toolbarbutton"></toolbarbutton> -->
</toolbar>
<button></button>
<button></button>
<button></button>
</window>
</zk>
replace the toolbarbutton by the commented line (toolbar button with a tabindex value), and the modal window is able to keep the focus.