From 682d01725fb2c9eade21063944671032b6703e33 Mon Sep 17 00:00:00 2001 From: Chris Gilligan <49878588+UTCGilligan@users.noreply.github.com> Date: Wed, 31 Dec 2025 09:38:27 -0500 Subject: [PATCH 1/6] UTCT-228: Skiplink and styles for accessibility. Signed-off-by: Chris Gilligan <49878588+UTCGilligan@users.noreply.github.com> --- frontend/assets/sass/styles.scss | 22 ++++ frontend/dist/styles.css | 23 ---- frontend/footer.php | 7 +- index.php | 177 ++++++++++++++++++++----------- 4 files changed, 145 insertions(+), 84 deletions(-) diff --git a/frontend/assets/sass/styles.scss b/frontend/assets/sass/styles.scss index ba33b05..e6d2baf 100644 --- a/frontend/assets/sass/styles.scss +++ b/frontend/assets/sass/styles.scss @@ -97,3 +97,25 @@ $border-radius: 6px; } } } +.visually-hidden { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border: 0 !important; +} + +.visually-hidden-focusable:active, +.visually-hidden-focusable:focus { + position: static !important; + width: auto !important; + height: auto !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; +} diff --git a/frontend/dist/styles.css b/frontend/dist/styles.css index 4422acd..898190f 100644 --- a/frontend/dist/styles.css +++ b/frontend/dist/styles.css @@ -9369,27 +9369,4 @@ textarea.form-control-lg { width: 100%; border-radius: 6px !important; } -} -/* Extra styling for the skip link when it becomes visible */ -.skip-link { - background-color: #0d6efd; /* Bootstrap primary */ - color: #fff; - padding: 0.5rem 1rem; - text-decoration: none; - position: absolute; - top: 0.5rem; - left: 0.5rem; - z-index: 1050; -} - -.skip-link:focus { - outline: 3px solid #ffc107; -} - -/* Highlight the "Customize Link" toggle when it has keyboard focus */ -.btn.btn-link:focus, -.btn.btn-link:focus-visible { - outline: 3px solid #ffc107 !important; - outline-offset: 2px; - box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.5) !important; } \ No newline at end of file diff --git a/frontend/footer.php b/frontend/footer.php index 17f2ec6..a67e8ce 100644 --- a/frontend/footer.php +++ b/frontend/footer.php @@ -45,13 +45,18 @@ function copyTextToClipboard(text) { copyBtn.addEventListener('click', function(event) { copyTextToClipboard(event.target.dataset.shorturl); }); + + // Move focus to copy button when result screen is shown + window.addEventListener('load', function () { + copyBtn.focus(); + }); } const closeShortenedLinkScreenButton = document.querySelector('button#close-shortened-screen'); if (closeShortenedLinkScreenButton) { closeShortenedLinkScreenButton.addEventListener('click', function(event) { - window.location.href=window.location.href; + window.location.href = window.location.href; }); } diff --git a/index.php b/index.php index 51f7c1f..448f661 100644 --- a/index.php +++ b/index.php @@ -84,79 +84,136 @@ function shorten()
-