remove flickering; keep range selection; remove media selection when click outside