summaryrefslogtreecommitdiff
path: root/src/web/helpers/aria.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-05-24 09:05:42 -0400
committerFreya Murphy <freya@freyacat.org>2024-05-24 09:05:42 -0400
commitc5f39ea2cd7cf02246705ea8872d3b350526165c (patch)
tree2694f9fdc5d83b529a01f2997c1d89c271c86592 /src/web/helpers/aria.php
downloadwebsite-c5f39ea2cd7cf02246705ea8872d3b350526165c.tar.gz
website-c5f39ea2cd7cf02246705ea8872d3b350526165c.tar.bz2
website-c5f39ea2cd7cf02246705ea8872d3b350526165c.zip
initial
Diffstat (limited to 'src/web/helpers/aria.php')
-rw-r--r--src/web/helpers/aria.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/web/helpers/aria.php b/src/web/helpers/aria.php
new file mode 100644
index 0000000..8ebfcc5
--- /dev/null
+++ b/src/web/helpers/aria.php
@@ -0,0 +1,16 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+
+function aria_section($id, $title = NULL): string {
+ $out = '';
+ if ($title) {
+ $idh = $id . '_heading';
+ $out .= sprintf('<div id="%s" class="section" role="region" aria-labelledby="%s">',
+ $id, $idh);
+ $out .= sprintf('<h2 class="heading" id="%s">%s</h2>',
+ $idh, $title);
+ } else {
+ $out .= sprintf('<div id="%s" class="section" role="region">',
+ $id);
+ }
+ return $out;
+}