From 79693fe6fc31c3484c791ad260ef7ff066f883ef Mon Sep 17 00:00:00 2001 From: Score_Under Date: Tue, 8 Dec 2020 15:48:03 +0000 Subject: [PATCH] Fix style on sites like example.com Fix lusakasa/saka-key#305: Stop websites from accidentally re-styling div elements belonging to saka-key. --- src/client/gui.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/client/gui.js b/src/client/gui.js index b1b530c..136b775 100644 --- a/src/client/gui.js +++ b/src/client/gui.js @@ -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; @@ -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) {