Fix frontpage keyboard navigation. More cleanup.

This commit is contained in:
Greg Sarjeant 2025-06-20 22:37:54 -04:00
parent 9eafadde2f
commit 4ce938e7bc
5 changed files with 15 additions and 17 deletions

View File

@ -20,7 +20,7 @@ class Util {
$escaped_url = rtrim($matches[1], '.,!?;:)]}>'); $escaped_url = rtrim($matches[1], '.,!?;:)]}>');
$clean_url = html_entity_decode($escaped_url, ENT_QUOTES, 'UTF-8'); $clean_url = html_entity_decode($escaped_url, ENT_QUOTES, 'UTF-8');
return '<a href="' . $clean_url . '"' . $link_attrs . '>' . $escaped_url . '</a>'; return '<a tabindex="0" href="' . $clean_url . '"' . $link_attrs . '>' . $escaped_url . '</a>';
}, },
$text $text
); );

View File

@ -4,7 +4,7 @@ class HomeView {
ob_start(); ob_start();
?> ?>
<ul class="tick-feed" role="feed" aria-label="Recent updates"> <ul class="tick-feed" aria-label="Recent updates">
<?php foreach ($ticks as $tick): ?> <?php foreach ($ticks as $tick): ?>
<?php <?php
$datetime = new DateTime($tick['timestamp'], new DateTimeZone('UTC')); $datetime = new DateTime($tick['timestamp'], new DateTimeZone('UTC'));
@ -18,10 +18,10 @@ class HomeView {
</ul> </ul>
<div class="tick-pagination"> <div class="tick-pagination">
<?php if ($page > 1): ?> <?php if ($page > 1): ?>
<a href="?page=<?php echo $page - 1 ?>">&laquo; Newer</a> <a tabindex="0" href="?page=<?php echo $page - 1 ?>">&laquo; Newer</a>
<?php endif; ?> <?php endif; ?>
<?php if (count($ticks) === $limit): ?> <?php if (count($ticks) === $limit): ?>
<a href="?page=<?php echo $page + 1 ?>">Older &raquo;</a> <a tabindex="0" href="?page=<?php echo $page + 1 ?>">Older &raquo;</a>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -12,7 +12,7 @@
<span class="profile-greeting-content-mood"><?php echo Util::escape_html($user->mood) ?></span> <span class="profile-greeting-content-mood"><?php echo Util::escape_html($user->mood) ?></span>
</span> </span>
<?php if (Session::isLoggedIn()): ?> <?php if (Session::isLoggedIn()): ?>
<a href="<?= $config->basePath ?>mood" class="change-mood">Change mood</a> <a tabindex="0" href="<?= $config->basePath ?>mood" class="change-mood">Change mood</a>
<?php endif ?> <?php endif ?>
</dd> </dd>
<?php if (!empty($user->about)): ?> <?php if (!empty($user->about)): ?>
@ -43,9 +43,7 @@
<?php endif; ?> <?php endif; ?>
</aside> </aside>
<main id="ticks"> <main id="ticks">
<div class="home-header"> <h1 class="site-description"><?= $config->siteDescription ?></h1>
<h1 class="site-description"><?= $config->siteDescription ?></h1>
</div>
<?php echo $tickList ?> <?php echo $tickList ?>
</main> </main>
</div> </div>

View File

@ -1,25 +1,25 @@
<?php /** @var ConfigModel $config */ ?> <?php /** @var ConfigModel $config */ ?>
<?php /* https://www.w3schools.com/howto/howto_css_dropdown.asp */ ?> <?php /* https://www.w3schools.com/howto/howto_css_dropdown.asp */ ?>
<nav aria-label="Main navigation"> <nav aria-label="Main navigation">
<a href="<?= $config->basePath ?>">home</a> <a tabindex="0" href="<?= $config->basePath ?>">home</a>
<details> <details>
<summary aria-haspopup="true">feeds</summary> <summary aria-haspopup="true">feeds</summary>
<div class="dropdown-items"> <div class="dropdown-items">
<a href="<?= $config->basePath ?>feed/rss">rss</a> <a tabindex="0" href="<?= $config->basePath ?>feed/rss">rss</a>
<a href="<?= $config->basePath ?>feed/atom">atom</a> <a tabindex="0" href="<?= $config->basePath ?>feed/atom">atom</a>
</div> </div>
</details> </details>
<?php if (!Session::isLoggedIn()): ?> <?php if (!Session::isLoggedIn()): ?>
<a href="<?= $config->basePath ?>login">login</a> <a tabindex="0" href="<?= $config->basePath ?>login">login</a>
<?php else: ?> <?php else: ?>
<details> <details>
<summary aria-haspopup="true">admin</summary> <summary aria-haspopup="true">admin</summary>
<div class="dropdown-items"> <div class="dropdown-items">
<a href="<?= $config->basePath ?>admin">settings</a> <a tabindex="0" href="<?= $config->basePath ?>admin">settings</a>
<a href="<?= $config->basePath ?>admin/css">css</a> <a tabindex="0" href="<?= $config->basePath ?>admin/css">css</a>
<a href="<?= $config->basePath ?>admin/emoji">emoji</a> <a tabindex="0" href="<?= $config->basePath ?>admin/emoji">emoji</a>
</div> </div>
</details> </details>
<a href="<?= $config->basePath ?>logout">logout</a> <a tabindex="0" href="<?= $config->basePath ?>logout">logout</a>
<?php endif; ?> <?php endif; ?>
</nav> </nav>