From cb46fa3d487403920e0585b32df3b6a636fbe41d Mon Sep 17 00:00:00 2001 From: Pat Date: Wed, 29 Nov 2023 15:24:34 -0700 Subject: [PATCH 1/2] Adds screen-reader text to Read More links on Article List, Article Feature, and Article List Blocks --- css/block/ucb-article-list-block.css | 1 - js/ucb-article-feature-block.js | 17 ++++++++++++++++- js/ucb-article-list-block.js | 16 ++++++++++++++++ js/ucb-article-list.js | 5 +++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/css/block/ucb-article-list-block.css b/css/block/ucb-article-list-block.css index a02fe0e2..d7d33fcb 100644 --- a/css/block/ucb-article-list-block.css +++ b/css/block/ucb-article-list-block.css @@ -58,7 +58,6 @@ text-transform: uppercase; font-weight: 600; font-size: 75%; - padding-bottom: 20px; } .ucb-article-card-summary{ diff --git a/js/ucb-article-feature-block.js b/js/ucb-article-feature-block.js index 99e35a2f..ac0c6ed6 100644 --- a/js/ucb-article-feature-block.js +++ b/js/ucb-article-feature-block.js @@ -277,6 +277,11 @@ class ArticleFeatureBlockElement extends HTMLElement { featureReadMore.className = 'ucb-article-read-more' featureReadMore.href = article.link; featureReadMore.innerText = 'Read More' + //Screen Reader text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${article.title}` + featureReadMore.appendChild(srOnly) // Append featureContainer.appendChild(featureImgLink) @@ -373,6 +378,11 @@ class ArticleFeatureBlockElement extends HTMLElement { featureReadMore.className = 'ucb-article-read-more' featureReadMore.href = article.link; featureReadMore.innerText = 'Read More' + //Screen Reader text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${article.title}` + featureReadMore.appendChild(srOnly) // Append featureContainer.appendChild(featureImgLink) @@ -469,7 +479,12 @@ class ArticleFeatureBlockElement extends HTMLElement { featureReadMore.className = 'ucb-article-read-more' featureReadMore.href = article.link; featureReadMore.innerText = 'Read More' - + //Screen Reader text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${article.title}` + featureReadMore.appendChild(srOnly) + // Append featureContainer.appendChild(featureImgLink) featureContainer.appendChild(featureTitle) diff --git a/js/ucb-article-list-block.js b/js/ucb-article-list-block.js index 3bb62edf..2293ff33 100644 --- a/js/ucb-article-list-block.js +++ b/js/ucb-article-list-block.js @@ -293,6 +293,12 @@ class ArticleListBlockElement extends HTMLElement { readMore.classList = 'ucb-article-card-read-more' readMore.innerText = `Read More`; + // Sr-only text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${articleTitle}` + readMore.appendChild(srOnly) + articleBody.appendChild(headerLink) articleBody.appendChild(date) articleBody.appendChild(articleSummary) @@ -360,6 +366,11 @@ class ArticleListBlockElement extends HTMLElement { readMore.href = articleLink; readMore.classList = 'ucb-article-card-read-more' readMore.innerText = `Read More`; + // Sr-only text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${articleTitle}` + readMore.appendChild(srOnly) articleBody.appendChild(headerLink) articleBody.appendChild(date) @@ -508,6 +519,11 @@ class ArticleListBlockElement extends HTMLElement { readMore.href = articleLink; readMore.classList = 'ucb-article-card-read-more' readMore.innerText = `Read More`; + // Sr-only text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${articleTitle}` + readMore.appendChild(srOnly) articleBody.appendChild(headerLink) articleBody.appendChild(date) diff --git a/js/ucb-article-list.js b/js/ucb-article-list.js index a0916bef..558c9282 100644 --- a/js/ucb-article-list.js +++ b/js/ucb-article-list.js @@ -270,6 +270,11 @@ function renderArticleList( JSONURL, ExcludeCategories = "", ExcludeTags = "") { var readMoreLink = document.createElement('a') readMoreLink.href = link; readMoreLink.innerText = `Read more` + //Screen Reader text + var srOnly = document.createElement('span') + srOnly.className = 'sr-only' + srOnly.innerText = ` about ${title}` + readMoreLink.appendChild(srOnly) articleSummaryReadMore.appendChild(readMoreLink) From 8c5d9e4ecb90d07f6613989377c42066308c7c96 Mon Sep 17 00:00:00 2001 From: Pat Date: Wed, 29 Nov 2023 15:35:17 -0700 Subject: [PATCH 2/2] Corrects padding on Read More Article links --- css/block/ucb-article-feature-block.css | 1 - 1 file changed, 1 deletion(-) diff --git a/css/block/ucb-article-feature-block.css b/css/block/ucb-article-feature-block.css index d5d4aa9d..3076f3f6 100644 --- a/css/block/ucb-article-feature-block.css +++ b/css/block/ucb-article-feature-block.css @@ -43,7 +43,6 @@ text-transform: uppercase; font-weight: 600; font-size: 75%; - padding-bottom: 20px; } .ucb-article-card{