Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

a11y[Op#52605]: Announce access granted message as first result

Kabiru Mwenjacea19d9bfa7a
diff --git a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.html.erb b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.html.erb
index 12bf95627b8..24401a76624 100644
--- a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.html.erb
+++ b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.html.erb
@@ -19,12 +19,14 @@
data: {
'storages--oauth-access-grant-nudge-modal-target': 'header'
},
- test_selector: 'oauth-access-grant-nudge-modal-header'
+ test_selector: 'oauth-access-grant-nudge-modal-header',
+ visually_hide_title: authorized
)
dialog.with_body(
id: dialog_body_id,
- test_selector: 'oauth-access-grant-nudge-modal-body'
+ test_selector: 'oauth-access-grant-nudge-modal-body',
+ aria: { hidden: authorized }
) do
concat(
render(
diff --git a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb
index 270f9869f1a..61e02d1a03b 100644
--- a/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb
+++ b/modules/storages/app/components/storages/admin/oauth_access_grant_nudge_modal_component.rb
@@ -49,9 +49,11 @@ module Storages::Admin
private
def title
- return if authorized
-
- I18n.t('storages.oauth_grant_nudge_modal.title')
+ if authorized
+ I18n.t('storages.oauth_grant_nudge_modal.access_granted_screen_reader', storage: project_storage.storage.name)
+ else
+ I18n.t('storages.oauth_grant_nudge_modal.title')
+ end
end
def waiting_title
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index af70f976de5..b31b75dfcde 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -180,6 +180,7 @@ en:
of each desired project to use it.
oauth_grant_nudge_modal:
access_granted: Access granted
+ access_granted_screen_reader: Access granted. You are now ready to use %{storage}.
body: To get access to the project folder you need to login to %{storage}.
cancel_button_label: I will do it later
confirm_button_aria_label: Login to %{storage}
diff --git a/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb b/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb
index fe2b6c0c023..9cc9a080d48 100644
--- a/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb
+++ b/modules/storages/spec/components/storages/admin/oauth_access_grant_nudge_modal_component_spec.rb
@@ -49,6 +49,7 @@ RSpec.describe Storages::Admin::OAuthAccessGrantNudgeModalComponent, type: :comp
expect(page).to have_test_selector(
'oauth-access-grant-nudge-modal-body',
text: "To get access to the project folder you need to login to #{project_storage.storage.name}.",
+ aria: { hidden: false }
)
expect(page).to have_button('I will do it later')
@@ -62,10 +63,20 @@ RSpec.describe Storages::Admin::OAuthAccessGrantNudgeModalComponent, type: :comp
end
it 'renders a success modal' do
- expect(page).to have_text('Access granted')
+ expect(page).to have_css(
+ 'h1.sr-only',
+ text: "Access granted. You are now ready to use #{project_storage.storage.name}"
+ )
+
+ expect(page).to have_test_selector(
+ 'oauth-access-grant-nudge-modal-body',
+ text: 'Access granted',
+ aria: { hidden: true }
+ )
expect(page).to have_test_selector(
'oauth-access-grant-nudge-modal-body',
text: "You are now ready to use #{project_storage.storage.name}",
+ aria: { hidden: true }
)
expect(page).to have_button('Close')