Commit e71b2c58 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch '216333-fj-replace-title-attribute-with-aria-label-in-sidebar' into 'master'

Replace title attribute in project sidebar for aria-label

See merge request gitlab-org/gitlab!59643
parents e90523a9 2089986a
...@@ -7,7 +7,7 @@ module Sidebars ...@@ -7,7 +7,7 @@ module Sidebars
# `link_to` or the div containing the container. # `link_to` or the div containing the container.
def container_html_options def container_html_options
{ {
title: title aria: { label: title }
}.merge(extra_container_html_options) }.merge(extra_container_html_options)
end end
......
...@@ -14,7 +14,7 @@ module Sidebars ...@@ -14,7 +14,7 @@ module Sidebars
override :extra_container_html_options override :extra_container_html_options
def extra_container_html_options def extra_container_html_options
{ {
title: _('Project details'), aria: { label: _('Project details') },
class: 'shortcuts-project' class: 'shortcuts-project'
} }
end end
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
%ul.sidebar-sub-level-items{ class: ('is-fly-out-only' unless sidebar_menu.has_items?) } %ul.sidebar-sub-level-items{ class: ('is-fly-out-only' unless sidebar_menu.has_items?) }
= nav_link(**sidebar_menu.all_active_routes, html_options: { class: 'fly-out-top-item' } ) do = nav_link(**sidebar_menu.all_active_routes, html_options: { class: 'fly-out-top-item' } ) do
= link_to sidebar_menu.link, title: sidebar_menu.title do = link_to sidebar_menu.link, aria: { label: sidebar_menu.title } do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
= sidebar_menu.title = sidebar_menu.title
- if sidebar_menu.has_pill? - if sidebar_menu.has_pill?
......
...@@ -14,8 +14,8 @@ RSpec.describe Sidebars::ContainerWithHtmlOptions do ...@@ -14,8 +14,8 @@ RSpec.describe Sidebars::ContainerWithHtmlOptions do
end end
describe '#container_html_options' do describe '#container_html_options' do
it 'includes title attribute' do it 'includes by default aria-label attribute' do
expect(subject.container_html_options).to eq(title: 'Foo') expect(subject.container_html_options).to eq(aria: { label: 'Foo' })
end end
end end
end end
...@@ -24,6 +24,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -24,6 +24,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
render render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link)) expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project overview"]')
end end
describe 'Details' do describe 'Details' do
...@@ -31,6 +32,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -31,6 +32,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
render render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project') expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project')
expect(rendered).to have_selector('[aria-label="Project details"]')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment