Skip to content

Commit

Permalink
Merge pull request #574 from CuBoulder/issue/570
Browse files Browse the repository at this point in the history
Enhanced Screen-Reader Text on 'Read More' links for Articles served by Article List Pages + Article Blocks
  • Loading branch information
jcsparks authored Dec 1, 2023
2 parents e4fa183 + c0ea6bf commit c1ce150
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
1 change: 0 additions & 1 deletion css/block/ucb-article-feature-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
text-transform: uppercase;
font-weight: 600;
font-size: 75%;
padding-bottom: 20px;
}

.ucb-article-card{
Expand Down
1 change: 0 additions & 1 deletion css/block/ucb-article-list-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
text-transform: uppercase;
font-weight: 600;
font-size: 75%;
padding-bottom: 20px;
}

.ucb-article-card-summary{
Expand Down
17 changes: 16 additions & 1 deletion js/ucb-article-feature-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions js/ucb-article-list-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions js/ucb-article-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c1ce150

Please sign in to comment.