diff --git a/code/keebs.js b/code/keebs.js
index 2bd5d9b7..8fa27a30 100644
--- a/code/keebs.js
+++ b/code/keebs.js
@@ -1,16 +1,14 @@
/**
*
- *
- *
- * powered by x-keyboard
- * géométrie :
- *
- *
+ *
+ *
+ *
+ *
*
*
@@ -54,7 +52,7 @@ for (const keeb of document.querySelectorAll('.keyboard')) {
const dialog = keeb.querySelector('dialog');
const keyboard = keeb.querySelector('x-keyboard');
const preview = keeb.querySelector('object');
- const input = keeb.querySelector('input');
+ const input = keeb.querySelector('input[placeholder]');
const form = keeb.querySelector('form');
const geometry = keeb.querySelector('select') || document.getElementById('geometry');
const button = keeb.querySelector('button');
@@ -101,15 +99,15 @@ for (const keeb of document.querySelectorAll('.keyboard')) {
/**
* Open/Close modal
*/
- if (button) button.onclick = () => {
+ button?.addEventListener('click', () => {
dialog?.showModal();
input.value = '';
input.focus();
- }
- input.onblur = () => {
+ });
+ input.addEventListener('blur', () => {
keyboard.clearStyle()
dialog?.close();
- }
+ });
/**
* Keyboard highlighting & layout emulation
@@ -119,7 +117,7 @@ for (const keeb of document.querySelectorAll('.keyboard')) {
const pressedKeys = {};
// highlight keyboard keys and emulate the selected layout
- input.onkeydown = event => {
+ input.addEventListener('keydown', event => {
pressedKeys[event.code] = true;
const value = keyboard.keyDown(event);
@@ -131,7 +129,7 @@ for (const keeb of document.querySelectorAll('.keyboard')) {
return true; // don't intercept special keys or key shortcuts
}
return false; // event has been consumed, stop propagation
- };
+ });
input.addEventListener('keyup', event => {
if (pressedKeys[event.code]) {
diff --git a/code/x-keyboard.js b/code/x-keyboard.js
index e6b7c545..bcafb6ef 100644
--- a/code/x-keyboard.js
+++ b/code/x-keyboard.js
@@ -960,7 +960,7 @@ const themes = `
.dk .level4 { display: none; }
@media (prefers-color-scheme: dark) {
- rect, path { stroke: #777; fill: #444; }
+ rect, path { stroke: #777; fill: #4d4d4d; }
.specialKey, .specialKey rect, .specialKey path { fill: #333; }
g:target rect, .press rect, g:target path, .press path { fill: #558; }
text { fill: #bbb; }
diff --git a/www/assets/css/keebs.css b/www/assets/css/keebs.css
index c43e87e9..e2340a5c 100644
--- a/www/assets/css/keebs.css
+++ b/www/assets/css/keebs.css
@@ -39,6 +39,10 @@
* ╰───────────────────────────────────────────────────────────────╯
**/
+.keyboard [hidden] {
+ visibility: hidden;
+}
+
.keyboard form {
display: flex;
justify-content: right;
@@ -79,6 +83,11 @@
cursor: pointer;
}
+.keyboard form input:hover {
+ background-color: var(--bg-accent);
+ opacity: 1;
+}
+
.keyboard form input:checked {
background-image: linear-gradient(180deg, var(--bg-letter), var(--bg-home));
background-color: var(--bg-normal);
diff --git a/www/layouts/shortcodes/x-keyboard.html b/www/layouts/shortcodes/x-keyboard.html
index 74b175dc..3b82acc4 100644
--- a/www/layouts/shortcodes/x-keyboard.html
+++ b/www/layouts/shortcodes/x-keyboard.html
@@ -32,14 +32,6 @@
-
-
{{ if $name }}
{{ with .Get "data" }}