简体   繁体   中英

Text gets highlighted if clicked with shift IE-11

I have a page with multiple tiles implementing shift-key multi-select. The problem occurring only in IE-11 is that if any text field is clicked shift-key multi-selecting, the whole browser's text gets highlighted. I have read other answers and none seem to work, including -ms-user-select: none , removeAllRanges() etc. One thing to note is that if I try and highlight a text field without pressing shift, it doesn't get highlighted ( apparently the user-select: none is working here). is there any css-only solution available then?

Without clicking any text: 在此处输入图片说明

If any text is clicked:

在此处输入图片说明

The trick was to use event.PreventDefault() not only in the onClick() event but also for the mouseDown() event. Otherwise, the text will be highlighted as long as the click isn't released.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM