Skip to content

Instantly share code, notes, and snippets.

@Splode
Last active December 20, 2023 03:12
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Splode/a2ae4f5dbfaca98efad9f93f51832146 to your computer and use it in GitHub Desktop.
Save Splode/a2ae4f5dbfaca98efad9f93f51832146 to your computer and use it in GitHub Desktop.
Disable selection/highlighting and element draggin in Electron
/* disable selection */
:not(input):not(textarea),
:not(input):not(textarea)::after,
:not(input):not(textarea)::before {
-webkit-user-select: none;
user-select: none;
cursor: default;
}
input, button, textarea, :focus {
outline: none;
}
/* disable image and anchor dragging */
a:not([draggable=true]), img:not([draggable=true]) {
-webkit-user-drag: none;
user-drag: none;
}
a[href^="http://"],
a[href^="https://"],
a[href^="ftp://"] {
-webkit-user-drag: auto;
user-drag: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment