Skip to content

Commit

Permalink
Add access restriction message for screen readers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy Ingulfsen committed Sep 1, 2016
1 parent ab63098 commit 37c2e12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/embed/media_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def media_element(label, file, type)
data-src="#{streaming_url_for(file, :dash)}"
data-auth-url="#{authentication_url(file)}"
controls='controls'
aria-labelledby="access-restricted-message-div-#{file_index}"
class="#{'sul-embed-many-media' if many_primary_files?}"
style="height: #{media_element_height}; display:none;"
height="#{media_element_height}">
Expand Down Expand Up @@ -125,7 +126,7 @@ def access_restricted_overlay(stanford_only, location_restricted)
# TODO: line1 and line1 spans should be populated by values returned from stacks
<<-HTML.strip_heredoc
<div class='sul-embed-media-access-restricted-container' data-access-restricted-message>
<div class='sul-embed-media-access-restricted'>
<div class='sul-embed-media-access-restricted' id="access-restricted-message-div-#{file_index}">
#{access_restricted_message(stanford_only, location_restricted)}
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/embed/media_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
it 'includes a height attribute equal to the body height' do
expect(subject).to have_css("video[height='#{viewer.body_height}px']", visible: false)
end

it 'shows location restricted messages to the screen reader' do
expect(subject).to have_css('video[aria-labelledby="access-restricted-message-div-0"]', visible: false)
expect(subject).to have_css('div#access-restricted-message-div-0')
end
end

context 'multiple videos' do
Expand Down

0 comments on commit 37c2e12

Please sign in to comment.