2

I was looking at how to change the cursor over an HTML5 canvas when dragging the mouse... Came across this: Change cursor over HTML5 Canvas when dragging the mouse

seemed logical that an :active pseudo-selector would do the trick...

When I used it on my page, however, the cursor set by the rule in the :active pseudo-selector was ignored, instead showing the text selection cursor.

In firefox, this behavior is not present - it obeys the cursor property I set.

Here's an example to demonstrate the behavior.

Any idea how to fix this in chrome?

Community
  • 1
  • 1
Valera
  • 98
  • 2
  • 10

1 Answers1

3

Working Fiddle

Add the following for Chrome to turn off text selection while dragging and dropping.

document.onselectstart = function(){ return false; }​

This has been answered a few times,

chrome sets cursor to text while dragging, why?

Click and Drag Cursor in Chrome

Community
  • 1
  • 1
Loktar
  • 34,764
  • 7
  • 90
  • 104
  • maybe you shall clarify the fact that document is indeed the canvas object not the document global variable. so the correct thing to say would be canvas.onselectstart = function() { return false; } – holographix May 22 '13 at 13:32