Skip to content

Commit

Permalink
Jsaraceno/media service video a11y (#40)
Browse files Browse the repository at this point in the history
* add contextual title to the title tag on media service elements

* use text instead of element in the title attr

* bump package version
  • Loading branch information
joesaraceno authored Feb 7, 2020
1 parent a83d718 commit a1da433
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/content/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@healthwise-ui/content",
"version": "0.0.15",
"version": "0.0.16",
"description": "Shared React UI library to use with Healthwise content.",
"main": "index.js",
"unpkg": "healthwise-ui.min.js",
Expand Down
10 changes: 6 additions & 4 deletions packages/content/src/MediaServiceVideo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ class MediaServiceVideo extends Component {
const videoUrl = `${mediaServiceUrl}/html/${mediaToken}/${videoParts.id}/${videoParts.lang}?autostart=false&rt=${mediaToken}&hash=${mediaHash}&disclaimer=false`
let abstract = null
let type = null
let title = null
let titleText = null
let titleElement = null

if (!hideAbstract) {
const dom = this.parseHtml(`<div>${item.html}</div>`)
abstract = <SpanAbstract>{item.abstract.consumer}</SpanAbstract>
title = <H3Title>{dom.querySelector('h3').firstChild.nodeValue}</H3Title>
titleText = dom.querySelector('h3').firstChild.nodeValue
titleElement = <H3Title>{dom.querySelector('h3').firstChild.nodeValue}</H3Title>
}

if (!hideType) {
Expand All @@ -126,14 +128,14 @@ class MediaServiceVideo extends Component {
}}
>
{type}
{title}
{titleElement}
{abstract}
<Video
as="iframe"
ref={el => {
this.videoElement = el
}}
title="Video"
title={`Play Video ${titleText}`}
className={`hw-slide-video`}
src={videoUrl}
frameBorder="0"
Expand Down

0 comments on commit a1da433

Please sign in to comment.