In IE 10, when you click on any text while holding the CTRL key the browser selects the text (which means the text gains focus and I want to avoid this because I have some multi-select scenario where CTRL+click means add/remove-select).
How can I disable this "feature"?
BTW, I still want to be able to select the text using the usual mouse actions.
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
To disable the text selection highlighting in React, we can set the css property user-select to a value “none”. In the example above, we have added the browser prefixes for the user-select property, so it works the same in all browsers.
To disable text selection highlighting in Google Chrome browser using CSS just set -user-select CSS property to none. And no prefix is required for Google Chrome and Opera Browsers.
This feature can be disabled by disabling selection completely.
This can be done by using -ms-user-select which has been introduced in IE10. (see also: http://ie.microsoft.com/testdrive/HTML5/msUserSelect/Default.html)
Example: To disable selection add the following css class to the element containing the text or one of its parents:
.notselectable
{
-ms-user-select: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With