You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With out knowing the exact reason of dragging prevent default, being there, I suppose is more efficient to handle it using some simple css to achive the same result
Could also be pointer-events: none, but I am not sure if it will cause an accessibility issue
user-select: none won't prevent images from being dragged (at least not in Chrome where I just tested it). pointer-events: none makes the whole image "transparent" to any mouse interactions, but i'd be very careful with that as it also stops legitimate things like being able to right-click to save an image etc.
long story short: I'd leave this as is and keep using JS
(and note that in our docs, we don't use actual <img> elements but <svg>, so won't be able to directly test this ... and the extra styles for docs do have user-select: none for those svgs to prevent the <text> inside them from being selectable, but that's a completely separate issue to images)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With out knowing the exact reason of dragging prevent default, being there, I suppose is more efficient to handle it using some simple css to achive the same result
Could also be
pointer-events: none, but I am not sure if it will cause an accessibility issue