From 1acd0cf86a6751aac017e2457c971526018e7f6e Mon Sep 17 00:00:00 2001 From: Fabien Cazenave Date: Tue, 13 Feb 2024 23:21:10 +0100 Subject: [PATCH] use a proper dialog box (#118) --- 101.html | 29 +++++++++++++---------------- css/demo.css | 38 ++++++++++++++------------------------ index.html | 41 +++++++++++++++++++---------------------- js/demo.js | 24 ++++++++---------------- 4 files changed, 54 insertions(+), 78 deletions(-) diff --git a/101.html b/101.html index 4953e138..f616e442 100644 --- a/101.html +++ b/101.html @@ -27,22 +27,19 @@

Lafayette101

QWERTY-Lafayette, canal historique ! :-)

- + + + +

powered by + x-keyboard + géométrie : + +

+

diff --git a/css/demo.css b/css/demo.css index b975873d..edf9a67b 100644 --- a/css/demo.css +++ b/css/demo.css @@ -2,50 +2,40 @@ h1 button { float: right; } -#demo[hidden] { - display: none; +dialog::backdrop { + backdrop-filter: blur(5px); } -#demo { - display: flex; - position: fixed; - top: 0; - left: 0; - height: 100%; +dialog { + max-width: 66em; width: 100%; - background-color: rgba(0, 0, 0, 0.6); - z-index: 2; - text-align: center; -} - -#demo div { - width: 100%; - max-width: 54em; - background-color: #f4f4f0; - box-sizing: border-box; + padding: 2em; margin: auto; - padding: 1.5em 2em 1em; - border-radius: 5px; + border-radius: 10px; + box-sizing: border-box; + background-color: #f4f4f8; + border: 5px solid #fff4; } -#demo input { +dialog input { box-sizing: border-box; width: calc(100% - 8px); /* to match the 4px padding */ + height: 2em; text-align: center; font-size: 1.5em; margin-bottom: 1em; } -#demo p { +dialog p { margin: 1em 4px 0; /* to match the 4px padding */ text-align: right; } -#demo p span { +dialog p span { float: left; font-size: small; } -#demo p a { +dialog p a { color: brown; } diff --git a/index.html b/index.html index 660ba25c..9eb4c91b 100644 --- a/index.html +++ b/index.html @@ -5,9 +5,8 @@ QWERTY-Lafayette - - - + + @@ -19,23 +18,21 @@

QWERTY-Lafayette

les typographes exigeants.

- + + + +

powered by + x-keyboard + géométrie : + +

+
@@ -127,7 +124,7 @@

Ergonomie #

Lafayette permet une ergonomie plus poussée que les dispositions optimisées telles que Dvorak ou Bépo.

-

1DFH : “One Distance From Home” +

1DFH : “1u Distance From Home” #

De nos jours, c’est de loin le plus gros gain ergonomique qu’on puisse faire avec un clavier : n’utiliser aucune touche qui soit à plus @@ -174,7 +171,7 @@

Claviers compacts #

confort important ; et on peut même envisager de ne plus utiliser du tout de colonnes extérieures, supprimant ainsi radicalement toutes les extensions d’auriculaires.

-

Arsenik est un +

Arsenik est un exemple d’agencement de touches permettant aux utilisateurs avancés d’utiliser 100 % de Lafayette sur uniquement 33 touches :

diff --git a/js/demo.js b/js/demo.js index 8cff3e1d..47cf9ed1 100644 --- a/js/demo.js +++ b/js/demo.js @@ -1,11 +1,11 @@ window.addEventListener('DOMContentLoaded', () => { 'use strict'; // eslint-disable-line - const keyboard = document.querySelector('x-keyboard'); + const dialog = document.querySelector('dialog'); + const keyboard = document.querySelector('dialog x-keyboard'); + const input = document.querySelector('dialog input'); + const geometry = document.querySelector('dialog select'); const button = document.querySelector('button'); - const input = document.querySelector('input'); - const geometry = document.querySelector('#demo select'); - const demo = document.querySelector('#demo'); if (!keyboard.layout) { console.warn('web components are not supported'); @@ -31,23 +31,15 @@ window.addEventListener('DOMContentLoaded', () => { /** * Open/Close modal */ - function open() { - document.body.classList.add('demo'); - demo.hidden = false; + button.onclick = () => { + dialog.showModal(); input.value = ''; input.focus(); } - function close() { + input.onblur = () => { keyboard.clearStyle() - document.body.classList.remove('demo'); - demo.hidden = true; + dialog.close(); } - button.onclick = open; - demo.onclick = (event) => { - if (event.target.id === 'demo') { - close(); - } - }; /** * Keyboard highlighting & layout emulation