0

I'm stopping a mousedown event when my users press on a custom dropdown list. This is to avoid the default text-highlighting behaviour of the browser while the user is effectively dragging the mouse.

I'm doing this with a jQuery event.preventDefault() call in the handler function and returning false.

This has the desired effect, except that in Chrome it also prevents CSS :hover states to work while the mouse is still pressed.

Firefox doesn't suffer the same problem. The text highlighting is cancelled, and the :hover states continue to work as the user rolls over items with the mouse still pressed.

Is there a method that will work in Chrome too?

I could add further mouseover handlers to add custom classes, but I'd prefer a more graceful solution so I can use the :hover pseudo classes in my CSS.

Tim
  • 8,036
  • 2
  • 36
  • 52
  • Looks like the text-highlighting and event stopping are red herrings. Chrome just doesn't seem to activate :hover states with the mouse pressed. I may resorts to JS mouseovers – Tim Jul 05 '12 at 19:08
  • When you say custom dropdown do you mean something made up log list items and anchors? – Master Morality Jul 05 '12 at 19:56
  • yes. the items being rolled over are `
  • ` elements
  • – Tim Jul 06 '12 at 09:32