-
-
Save Imperat/89a9e0f55b98b47eeb77445ff886bd4b to your computer and use it in GitHub Desktop.
Reproduce bug with Electron webkit-app-region: drag
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP --> | |
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"> | |
<link href="./styles.css" rel="stylesheet"> | |
<title>Hello World!</title> | |
</head> | |
<body> | |
<div class="items-list" id="itemsList"> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
<div class="item"></div> | |
</div> | |
<script src="./index.js"></script> | |
</body> | |
</html> |
This file contains 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
const itemsList = document.getElementById('itemsList'); | |
itemsList.addEventListener('mouseleave', () => { | |
console.log('on mouse leave fired'); | |
}); |
This file contains 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
const { app, BrowserView, BrowserWindow } = require('electron') | |
function createWindow () { | |
const mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
titleBarStyle: 'hidden', | |
}); | |
const browserView = new BrowserView(); | |
mainWindow.addBrowserView(browserView); | |
browserView.setBounds({ x: 0, y: 0, width: 800, height: 200 }); | |
browserView.setAutoResize({ width: true }); | |
browserView.webContents.loadFile('index.html'); | |
browserView.webContents.openDevTools(); | |
} | |
app.whenReady().then(createWindow); |
This file contains 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
{ | |
"name": "lamentable-gene-rise-8rgoa", | |
"productName": "lamentable-gene-rise-8rgoa", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "leliakin", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "27.3.2" | |
} | |
} |
This file contains 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
body { | |
margin: 0; | |
} | |
.items-list { | |
margin-left: 100px; | |
max-width: 100%; | |
border: 1px solid orange; | |
display: flex; | |
flex-shrink: 1; | |
-webkit-app-region: drag; | |
} | |
.item { | |
padding: 10px; | |
width: 50px; | |
background: blue; | |
-webkit-app-region: no-drag; | |
} | |
.item:hover { | |
background: yellow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment