From 0ca36b8ec672569524248dd775c663772663eb9f Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Sat, 7 Nov 2026 14:45:34 +0100 Subject: [PATCH] Show keyboard shortcuts on presenter controls Tooltips are useless while presenting, so the controls now show their shortcut as [V], [H], [F] and [Q]; the QR overlay hints at [Esc]. Labels of dynamic buttons live in a [data-label] span so the hint survives updates. Shortcuts are exposed via aria-keyshortcuts and hidden on touch-only devices. Co-Authored-By: Claude Opus 5.5 --- templates/Admin/present.php | 25 ++++++++++++++----- .../Controller/AdminControllerTest.php | 2 ++ webroot/css/plenario.css | 9 +++++++ webroot/js/plenario.js | 4 +-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/templates/Admin/present.php b/templates/Admin/present.php index 8bca174..e79cb07 100644 --- a/templates/Admin/present.php +++ b/templates/Admin/present.php @@ -26,8 +26,9 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl); formattedJoinCode()) ?> - @@ -40,17 +41,29 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
✎ - + – - - - + + + - +
diff --git a/tests/TestCase/Controller/AdminControllerTest.php b/tests/TestCase/Controller/AdminControllerTest.php index 5498309..1b0ac3b 100644 --- a/tests/TestCase/Controller/AdminControllerTest.php +++ b/tests/TestCase/Controller/AdminControllerTest.php @@ -190,6 +190,8 @@ class AdminControllerTest extends TestCase $this->get("/admin/$token/present"); $this->assertResponseOk(); + $this->assertResponseContains('aria-keyshortcuts="V"'); + $this->assertResponseContains('[H]'); $this->assertSame($first->id, $this->pollsTable()->get($poll->id)->current_slide_id); $this->configRequest(['headers' => ['Accept' => 'application/json']]); diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css index e0b2585..a16f502 100644 --- a/webroot/css/plenario.css +++ b/webroot/css/plenario.css @@ -398,6 +398,15 @@ body.present { .stage__controls:hover, .stage__controls:focus-within { opacity: 1; } .ctrl { min-width: 44px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: var(--text); font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; } .ctrl:hover { background: rgba(255, 255, 255, .15); } +.ctrl { gap: 6px; } +/* Visible keyboard shortcuts – nobody hovers for tooltips during a talk. */ +.ctrl__key { font: inherit; font-size: .8em; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; } +.stage__qr { position: relative; } +.stage__qr .ctrl__key { display: block; margin-top: 2px; color: #444; text-align: center; } +.qr-overlay__hint { font-size: 1rem !important; color: var(--muted); } +@media (hover: none) and (pointer: coarse) { + .ctrl__key { display: none; } /* touch devices usually have no keyboard */ +} .ctrl-counter { color: var(--muted); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; } .qr-overlay { position: fixed; inset: 0; background: rgba(8, 9, 20, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: zoom-out; z-index: 10; } diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js index 8e2be2e..372bf5c 100644 --- a/webroot/js/plenario.js +++ b/webroot/js/plenario.js @@ -571,7 +571,7 @@ var voting = q('[data-voting]'); voting.hidden = !slide.isInteractive; - voting.textContent = quizPhase + voting.querySelector('[data-label]').textContent = quizPhase ? { ready: 'Quiz starten', running: 'Quiz beenden', finished: 'Quiz erneut öffnen' }[quizPhase] : (slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen'); @@ -603,7 +603,7 @@ function toggleHide() { hideResults = !hideResults; q('[data-results]').classList.toggle('is-hidden', hideResults); - q('[data-hide-results]').textContent = hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen'; + q('[data-hide-results] [data-label]').textContent = hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen'; } q('[data-hide-results]').addEventListener('click', toggleHide);