diff --git a/app/components/layout/sidebar/header_component.html.erb b/app/components/layout/sidebar/header_component.html.erb index 54dd499c1c..42404ebf56 100644 --- a/app/components/layout/sidebar/header_component.html.erb +++ b/app/components/layout/sidebar/header_component.html.erb @@ -1,5 +1,5 @@ -
-
+
+

<%= label %> -

-
+ + diff --git a/app/components/layout/sidebar_component.html.erb b/app/components/layout/sidebar_component.html.erb index 71664919ca..57189127a2 100644 --- a/app/components/layout/sidebar_component.html.erb +++ b/app/components/layout/sidebar_component.html.erb @@ -1,4 +1,4 @@ - + +
<%= body %>
<%= render ConfirmationComponent.new %> -
+
<% flash.each do |key, value| %> <%= viral_flash(type: key, data: value) %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 11505b31a6..cfcfd9ebc0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -658,7 +658,6 @@ en: data_exports: Data Exports goto: Go to groups: Groups - navigation: Main Navigation projects: Projects title: Your work workflows: Workflow Executions @@ -668,21 +667,17 @@ en: name: IRIDA Next navbar: account_dropdown: - aria_label: Account menu + label: Account menu profile: Edit profile sign_out: Sign out - title: Account collapse: - aria_label: Collapse navigation menu - title: Collapse + label: Collapse navigation menu expand: - aria_label: Expand navigation menu - title: Expand + label: Expand navigation menu new_dropdown: - aria_label: Create menu group: Create new group + label: Create menu project: Create new project - title: Create opens_in_new_tab: Opens in new tab screen_reader: close: Close diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c88a355ec7..b7dfe75de1 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -660,31 +660,26 @@ fr: data_exports: Exportations de données goto: Allez à groups: Groupes - navigation: Main navigation projects: Projets title: Votre travail workflows: Exécutions de flux de travail form: - error_notification: 'Veuillez examiner les problèmes ci-dessous :' + error_notification: 'Veuillez examiner les problèmes ci-dessous:' help: Aide name: IRIDA Next navbar: account_dropdown: - aria_label: Menu déroulant du compte + label: Menu déroulant du compte profile: Modifier le profil sign_out: Se déconnecter - title: Compte collapse: - aria_label: Réduire le menu de navigation - title: Réduire + label: Réduire le menu de navigation expand: - aria_label: Développer le menu de navigation - title: Agrandir + label: Développer le menu de navigation new_dropdown: - aria_label: Nouvel élément de menu group: Créer un nouveau groupe + label: Nouvel élément de menu project: Créer un nouveau projet - title: Créer opens_in_new_tab: S’ouvre dans un nouvel onglet screen_reader: close: Fermer diff --git a/test/components/layout/sidebar_component_test.rb b/test/components/layout/sidebar_component_test.rb index 9da9d9862b..f898c57e5a 100644 --- a/test/components/layout/sidebar_component_test.rb +++ b/test/components/layout/sidebar_component_test.rb @@ -4,29 +4,22 @@ module Layout class SidebarComponentTest < ViewComponent::TestCase - test 'renders with default classes' do + test 'renders navigation container with overlay' do render_inline(Layout::SidebarComponent.new) do |sidebar| sidebar.with_header(label: 'Header') end - assert_selector('aside') + assert_selector('nav#sidebar[aria-label="Main sidebar"]') + assert_selector('button[title="Collapse navigation menu"]') + assert_selector('.sidebar-overlay', visible: :all) end - test 'accepts custom classes' do - render_inline(Layout::SidebarComponent.new) do |sidebar| - sidebar.with_header(label: 'Header') - end - - # The component should render with the default structure - assert_selector('aside') - end - - test 'renders with header' do + test 'renders header slot content' do render_inline(Layout::SidebarComponent.new) do |sidebar| sidebar.with_header(label: 'Custom Header') end - assert_text('Custom Header') + assert_selector('[data-test-selector="sidebar-header-root"]', text: 'Custom Header') end test 'renders with sections' do @@ -62,8 +55,7 @@ class SidebarComponentTest < ViewComponent::TestCase sidebar.with_header(label: 'Header') end - # Verify the sidebar renders without pipeline-specific content - assert_selector('aside') + assert_selector('nav#sidebar') end test 'renders collapsed by default when specified' do @@ -72,7 +64,7 @@ class SidebarComponentTest < ViewComponent::TestCase end # The collapsed state is handled by JavaScript, so we just check the component renders - assert_selector('aside') + assert_selector('nav#sidebar') end test 'renders with icons' do @@ -105,7 +97,7 @@ class SidebarComponentTest < ViewComponent::TestCase end end - assert_selector('aside[aria-label]') + assert_selector('nav#sidebar[aria-label="Main sidebar"]') assert_selector('a[href="/projects"]', text: 'Projects') end @@ -123,5 +115,13 @@ class SidebarComponentTest < ViewComponent::TestCase # The menu items might be hidden by default, so we just check the button is rendered assert_selector('button', text: 'Configuration') end + + test 'renders help link with accessible label' do + render_inline(Layout::SidebarComponent.new) do |sidebar| + sidebar.with_header(label: 'Header') + end + + assert_selector('a[aria-label="Help - Opens in new tab"]', text: 'Help') + end end end diff --git a/test/components/layout_component_test.rb b/test/components/layout_component_test.rb index 3d2649f6a7..119b0c67da 100644 --- a/test/components/layout_component_test.rb +++ b/test/components/layout_component_test.rb @@ -28,10 +28,9 @@ class LayoutComponentTest < ViewComponent::TestCase href: '#main-content' # Verify sidebar structure - assert_selector 'aside' do + assert_selector 'nav#sidebar' do # Check for the presence of navigation items rather than specific text # This is more resilient to changes in the exact text content - assert_selector 'nav' # Check for the presence of navigation items assert_selector 'a[href="/-/projects"]', @@ -61,7 +60,7 @@ class LayoutComponentTest < ViewComponent::TestCase layout.with_body { 'Content' } end - # The layout controller might be on the aside or a parent element + # The layout controller might be on the nav or a parent element assert_selector '[data-controller~="layout"]' end @@ -75,7 +74,7 @@ class LayoutComponentTest < ViewComponent::TestCase layout.with_body { 'Content' } end - assert_selector 'aside' + assert_selector 'nav#sidebar' end test 'renders with custom sidebar classes' do @@ -92,7 +91,7 @@ class LayoutComponentTest < ViewComponent::TestCase end # Verify the sidebar renders with content - assert_selector 'aside' + assert_selector 'nav#sidebar' end test 'renders with multiple sections in sidebar' do diff --git a/test/system/groups_test.rb b/test/system/groups_test.rb index 8e9cd29ec0..18cbd1d4bb 100644 --- a/test/system/groups_test.rb +++ b/test/system/groups_test.rb @@ -21,7 +21,7 @@ def setup test 'can create a group' do visit groups_url - click_button I18n.t('general.navbar.new_dropdown.aria_label') + click_button I18n.t('general.navbar.new_dropdown.label') click_link I18n.t('general.navbar.new_dropdown.group') within %(div[data-controller="slugify"][data-controller-connected="true"]) do @@ -186,7 +186,7 @@ def setup assert_field I18n.t('activerecord.attributes.group.description'), with: group_description end - within 'aside#sidebar' do + within 'nav#sidebar' do assert_text group_name end diff --git a/test/system/projects_test.rb b/test/system/projects_test.rb index 9698f71ff6..e2d8922e1b 100644 --- a/test/system/projects_test.rb +++ b/test/system/projects_test.rb @@ -30,7 +30,7 @@ def setup test 'should have Project URL filled with user namespace, when creating a new project using the nav bar' do visit dashboard_projects_url - click_button I18n.t('general.navbar.new_dropdown.aria_label') + click_button I18n.t('general.navbar.new_dropdown.label') click_link I18n.t('general.navbar.new_dropdown.project') within %(div[data-controller="slugify"][data-controller-connected="true"]) do @@ -157,7 +157,7 @@ def setup assert_field I18n.t(:'activerecord.attributes.namespaces/project_namespace.name'), with: project_name assert_field I18n.t(:'activerecord.attributes.namespaces/project_namespace.description'), with: project_description - within 'aside#sidebar' do + within 'nav#sidebar' do assert_text project_name end