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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
a11y[Op#52605]: Convey loading process to screen readers
Kabiru Mwenja215ed3549b83
diff --git a/frontend/src/stimulus/controllers/dynamic/storages/oauth-access-grant-nudge-modal.controller.ts b/frontend/src/stimulus/controllers/dynamic/storages/oauth-access-grant-nudge-modal.controller.tsindex 233836821d0..335c8fd6c0c 100644--- a/frontend/src/stimulus/controllers/dynamic/storages/oauth-access-grant-nudge-modal.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/storages/oauth-access-grant-nudge-modal.controller.ts@@ -42,6 +42,7 @@ export default class OAuthAccessGrantNudgeModalController extends Controller<HTMstatic values = {closeButtonLabel: String,+ loadingScreenReaderMessage: String,};declare readonly requestAccessFormTarget:HTMLFormElement;@@ -53,6 +54,7 @@ export default class OAuthAccessGrantNudgeModalController extends Controller<HTMdeclare readonly hasRequestAccessButtonTarget:boolean;declare readonly closeButtonLabelValue:string;+ declare readonly loadingScreenReaderMessageValue:string;connect() {this.element.showModal();@@ -73,10 +75,15 @@ export default class OAuthAccessGrantNudgeModalController extends Controller<HTM// Hide the request access button and show the loading indicatorprivate activateLoadingState() {this.requestAccessButtonTarget.classList.add('d-none');++ // Set the close button label to "Cancel"this.closeButtonTarget.textContent = this.closeButtonLabelValue;- this.closeButtonTarget.setAttribute('aria-label', this.closeButtonLabelValue);- this.headerTarget.classList.add('d-none');+ // Convey to screen readers that we're waiting for the request+ this.headerTarget.classList.add('sr-only');+ this.headerTarget.textContent = this.loadingScreenReaderMessageValue;++ // Hide the request access body and show the loading indicatorthis.requestAccessBodyTarget.classList.add('d-none');this.loadingIndicatorTarget.classList.remove('d-none');}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.erbindex a1cb819b521..12bf95627b8 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@@ -6,22 +6,24 @@data: {'application-target': 'dynamic',controller: 'storages--oauth-access-grant-nudge-modal',- 'storages--oauth-access-grant-nudge-modal-close-button-label-value': I18n.t('button_close')+ 'storages--oauth-access-grant-nudge-modal-close-button-label-value': I18n.t('button_close'),+ 'storages--oauth-access-grant-nudge-modal-loading-screen-reader-message-value': waiting_title,},test_selector: 'oauth-access-grant-nudge-modal')) do |dialog|dialog.with_header(show_divider: false,+ role: :alert,+ aria: { live: :assertive },data: {'storages--oauth-access-grant-nudge-modal-target': 'header'- }+ },+ test_selector: 'oauth-access-grant-nudge-modal-header')dialog.with_body(id: dialog_body_id,- role: :status,- aria: { live: (authorized ? :assertive : :polite) },test_selector: 'oauth-access-grant-nudge-modal-body') doconcat(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.rbindex a48c1e1667b..fe2b6c0c023 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@@ -40,12 +40,15 @@ RSpec.describe Storages::Admin::OAuthAccessGrantNudgeModalComponent, type: :complet(:oauth_access_grant_nudge_modal_component) { described_class.new(project_storage:) }it 'renders the nudge modal' do- expect(page).to have_text('One more step...')+ expect(page).to have_test_selector(+ 'oauth-access-grant-nudge-modal-header',+ text: 'One more step...',+ aria: { live: :assertive },+ role: :alert+ )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: { live: :polite },- role: :status)expect(page).to have_button('I will do it later')@@ -63,8 +66,6 @@ RSpec.describe Storages::Admin::OAuthAccessGrantNudgeModalComponent, type: :compexpect(page).to have_test_selector('oauth-access-grant-nudge-modal-body',text: "You are now ready to use #{project_storage.storage.name}",- aria: { live: :assertive },- role: :status)expect(page).to have_button('Close')diff --git a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rbindex b725581ed5b..4f29845114f 100644--- a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb+++ b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb@@ -71,10 +71,12 @@ RSpec.describe 'OAuth Access Grant Nudge upon adding a storage to a project',expect(page).to have_text(storage.name)within_test_selector('oauth-access-grant-nudge-modal') do+ expect(page).to be_axe_cleanexpect(page).to have_text('One more step...')click_on('Login')expect(page).to have_text("Requesting access to #{storage.name}")+ expect(page).to be_axe_cleanendendend