I don't often work with HTML these days, and I'm working with some JS libraries that manipulate canvas. I got done all that I needed - but I just realized, that
- When the webpage starts, all text is selectable (titles, subtitles, notifications etc - basically all text in spans and divs)
- Then, I typically click on the canvas and interact with it
- But, if after clicking the canvas, I try to go to, say, the title span, and click on it to select - the text is not selectable anymore (and no text on the webpage is anymore, apart from text form inputs)
So, I tried looking into this, and found:
HTML input fields does not get focus when clicked
The root cause of the problem is
disableSelection()
. It is causing all the problems, but removing it is not a solution, as (at least in 2016 or slightly before), on touch-screen devices, you "have" to use this if you want to be able to move objects with jQuery.
So, disableSelection is apparently jQuery, but so far I have just used vanilla javascript in my project (I think, but some of the libraries I use might use jQuery).
Anyways, I thought - before I try to blindly copy/paste online code, in an attempt to restore selectability, - could I somehow confirm through the DOM inspector in the browser, that an element is selectable or not? Say, here is how my Firefox Inspector form Web Developer Tools looks like:
Is there something accessible in the Inspector, like a CSS property, to tell me if an object is selectable? If not, can I quickly run a JavaScript one-liner in the browser Console, and find out the selectability status of an element?