Fixed selection when it's not visible (fixed #2844)