Skip to content

Instantly share code, notes, and snippets.

@msuchodolski
Last active July 19, 2023 13:08
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save msuchodolski/41c9338f3a732379dc570142826ed76e to your computer and use it in GitHub Desktop.
Save msuchodolski/41c9338f3a732379dc570142826ed76e to your computer and use it in GitHub Desktop.
Disable dragging and selecting html elements (like links, images etc...) in Electron
/**
* MAKE ELECTRON APP FEEL MORE NATIVE
*
* * Prevent dragging all HTML elements, specially:
* - images
* - links (anchors)
*
* * Prevent text selection
*/
*, *::after, *::before {
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-app-region: no-drag;
cursor: default;
}
@NeurAlch
Copy link

NeurAlch commented Sep 6, 2022

Since I do want some text-selection and different cursors, I used only:

*, *::after, *::before {
	-webkit-user-drag: none;
	-webkit-app-region: no-drag;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment