new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Electron · API · all subjects

webcontents: drag & drop

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

WebPreferences navigateOnDragDrop property

The `navigateOnDragDrop` boolean property determines whether dragging and dropping a file or link onto the page causes a navigation. Default is `false`.

app-region CSS property for draggable windows

The `app-region` CSS property defines areas that can be used to drag windows when the default OS title bar has been removed. Setting `app-region: drag` marks a rectangular area as draggable. Setting `app-region: no-drag` excludes a rectangular area from a draggable region and re-enables pointer events for that area.

Draggable regions ignore pointer events

Draggable areas marked with `app-region: drag` ignore all pointer events. For example, a button element that overlaps a draggable region will not emit mouse clicks or mouse enter/exit events within that overlapping area.

Making entire window draggable with app-region

To make the whole window draggable, add `app-region: drag` as a style on the `body` element. When the entire window is made draggable this way, you must also mark buttons as non-draggable using `app-region: no-drag`, otherwise users will not be able to click on them.

Disable text selection in draggable regions

When creating a draggable region, the dragging behavior may conflict with text selection. To prevent accidental text selection during dragging, use `user-select: none` CSS property on the draggable area.

ELECTRON_DEBUG_DRAGGABLE_REGIONS environment variable

The `ELECTRON_DEBUG_DRAGGABLE_REGIONS` environment variable is an experimental debugging aid that paints draggable regions on top of the window and logs how often they change and what they cost. It may change or be removed without warning.

Context menus on draggable areas platform behavior

On some platforms, draggable areas are treated as non-client frames, causing a system menu to pop up when right-clicked. To make context menus behave correctly on all platforms, never use a custom context menu on draggable areas.

Give your agent this brain