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

@ -463,4 +463,4 @@ time {
width: auto;
min-width: auto;
}
}
}

View File

@ -20,7 +20,7 @@ class Util {
$escaped_url = rtrim($matches[1], '.,!?;:)]}>');
$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
);

View File

@ -4,7 +4,7 @@ class HomeView {
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
$datetime = new DateTime($tick['timestamp'], new DateTimeZone('UTC'));
@ -18,10 +18,10 @@ class HomeView {
</ul>
<div class="tick-pagination">
<?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 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; ?>
</div>

View File

@ -12,7 +12,7 @@
<span class="profile-greeting-content-mood"><?php echo Util::escape_html($user->mood) ?></span>
</span>
<?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 ?>
</dd>
<?php if (!empty($user->about)): ?>
@ -43,9 +43,7 @@
<?php endif; ?>
</aside>
<main id="ticks">
<div class="home-header">
<h1 class="site-description"><?= $config->siteDescription ?></h1>
</div>
<h1 class="site-description"><?= $config->siteDescription ?></h1>
<?php echo $tickList ?>
</main>
</div>

View File

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