diff --git a/lib/embed/media_tag.rb b/lib/embed/media_tag.rb index e9dc4d0cc..fbcb4f878 100644 --- a/lib/embed/media_tag.rb +++ b/lib/embed/media_tag.rb @@ -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}"> @@ -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
-
+
#{access_restricted_message(stanford_only, location_restricted)}
diff --git a/spec/lib/embed/media_tag_spec.rb b/spec/lib/embed/media_tag_spec.rb index 1f38aa1d1..e1ee6a859 100644 --- a/spec/lib/embed/media_tag_spec.rb +++ b/spec/lib/embed/media_tag_spec.rb @@ -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