Skip to content

Commit

Permalink
Fix style on sites like example.com
Browse files Browse the repository at this point in the history
Fix lusakasa#305:
Stop websites from accidentally re-styling div elements belonging to
saka-key.
  • Loading branch information
ScoreUnder committed Dec 8, 2020
1 parent 0f27ffd commit 79693fe
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/client/gui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
export const guiRoot = document.createElement('div')
guiRoot.id = 'saka-gui-root'
guiRoot.style = `all: unset;
guiRoot.className = 'saka-gui-root'
const style = `.saka-gui-root * {
all: revert;
}
div#saka-gui-root {
all: revert;
position: absolute;
left: 0;
top: 0;
Expand All @@ -9,8 +15,12 @@ height: 100%;
z-index: 2147483647;
opacity: 1;
background-color: transparent;
pointer-events: none;`
pointer-events: none;
}`
const styleElem = document.createElement('style')
styleElem.textContent = style

document.documentElement.appendChild(styleElem)
document.documentElement.appendChild(guiRoot)

export function handleFullscreenChange (event) {
Expand Down

0 comments on commit 79693fe

Please sign in to comment.