HTML5 draggable='false' not working in Firefox browser

后端 未结 4 1812
野的像风
野的像风 2020-12-16 12:28

I\'m simply trying to apply HTML5 draggable=\'false\' attribute to some images but it\'s not working in Firefox browser. In Chrome working fine but on Firefox, after sele

4条回答
  •  天命终不由人
    2020-12-16 13:11

    Update of sorts, the solution doesn't work with React, however adding the below does.

    onDragStart={(e) => { e.preventDefault() }}
    

    EDIT: returning false for ondragstart no longer works for more modern versions of Firefox (credit: Hooman Askari), in which case use the below.

    function dragStart(e) {
        e.preventDefault()
    }
    

    ...and on the element

    ondragstart="dragStart(e)"
    

提交回复
热议问题