fix #1549 by looking at ModalViews before other elements

Not sure it's the best solution, but had no better idea.