Skip to content

Commit e5b6e02

Browse files
authored
Merge pull request civicrm#12158 from agileware/Accessibility-Issue-4
Accessibility #4: Make alerts accessible, Added new setting under misc.
2 parents 865168d + d19abfd commit e5b6e02

File tree

8 files changed

+41
-2
lines changed

8 files changed

+41
-2
lines changed

CRM/Admin/Form/Setting/Miscellaneous.php

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
5454
'recentItemsProviders' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
5555
'dedupe_default_limit' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
5656
'remote_profile_submissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
57+
'allow_alert_autodismissal' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
5758
);
5859

5960
public $_uploadMaxSize;

CRM/Core/Resources.php

+1
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ public static function outputLocalizationJS() {
690690
'filters' => self::getEntityRefFilters(),
691691
),
692692
'ajaxPopupsEnabled' => self::singleton()->ajaxPopupsEnabled,
693+
'allowAlertAutodismissal' => Civi::settings()->get('allow_alert_autodismissal'),
693694
);
694695
print CRM_Core_Smarty::singleton()->fetchWith('CRM/common/l10n.js.tpl', $vars);
695696
CRM_Utils_System::civiExit();

api/v3/examples/Setting/GetFields.php

+15
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,21 @@ function setting_getfields_expectedresult() {
479479
'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.',
480480
'help_text' => '',
481481
),
482+
'allow_alert_autodismissal' => array(
483+
'group_name' => 'CiviCRM Preferences',
484+
'group' => 'core',
485+
'name' => 'allow_alert_autodismissal',
486+
'type' => 'Boolean',
487+
'quick_form_type' => 'YesNo',
488+
'default' => '1',
489+
'html_type' => 'radio',
490+
'add' => '4.7',
491+
'title' => 'Allow alerts to auto-dismiss?',
492+
'is_domain' => 1,
493+
'is_contact' => 0,
494+
'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.',
495+
'help_text' => '',
496+
),
482497
'editor_id' => array(
483498
'group_name' => 'CiviCRM Preferences',
484499
'group' => 'core',

js/Common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ if (!CRM.vars) CRM.vars = {};
12471247
unique: true
12481248
};
12491249
options = $.extend(extra, options);
1250-
options.expires = options.expires === false ? 0 : parseInt(options.expires, 10);
1250+
options.expires = (options.expires === false || !CRM.config.allowAlertAutodismissal) ? 0 : parseInt(options.expires, 10);
12511251
if (options.unique && options.unique !== '0') {
12521252
$('#crm-notification-container .ui-notify-message').each(function () {
12531253
if (title === $('h1', this).html() && text === $('.notify-content', this).html()) {

settings/Core.setting.php

+15
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,21 @@
192192
'description' => 'If enabled, CiviCRM will permit submissions from external sites to profiles. This is disabled by default to limit abuse.',
193193
'help_text' => NULL,
194194
),
195+
'allow_alert_autodismissal' => array(
196+
'group_name' => 'CiviCRM Preferences',
197+
'group' => 'core',
198+
'name' => 'allow_alert_autodismissal',
199+
'type' => 'Boolean',
200+
'quick_form_type' => 'YesNo',
201+
'default' => TRUE,
202+
'html_type' => 'radio',
203+
'add' => '4.7',
204+
'title' => 'Allow alerts to auto-dismiss?',
205+
'is_domain' => 1,
206+
'is_contact' => 0,
207+
'description' => 'If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.',
208+
'help_text' => NULL,
209+
),
195210
'editor_id' => array(
196211
'group_name' => 'CiviCRM Preferences',
197212
'group' => 'core',

templates/CRM/Admin/Form/Setting/Miscellaneous.tpl

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@
8585
<p class="description">{ts}If enabled, CiviCRM will allow users to submit profiles from external sites. This is disabled by default to limit abuse.{/ts}</p>
8686
</td>
8787
</tr>
88+
<tr class="crm-miscellaneous-form-block-allow_alert_autodismissal">
89+
<td class="label">{$form.allow_alert_autodismissal.label}</td>
90+
<td>{$form.allow_alert_autodismissal.html}<br />
91+
<p class="description">{ts}If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.{/ts}</p>
92+
</td>
93+
</tr>
8894
</table>
8995

9096
<h3>{ts}reCAPTCHA Keys{/ts}</h3>

templates/CRM/common/l10n.js.tpl

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
$.datepicker._defaults.dateFormat = CRM.config.dateInputFormat = {$config->dateInputFormat|@json_encode};
3434
CRM.config.timeIs24Hr = {if $config->timeInputFormat eq 2}true{else}false{/if};
3535
CRM.config.ajaxPopupsEnabled = {$ajaxPopupsEnabled|@json_encode};
36+
CRM.config.allowAlertAutodismissal = {$allowAlertAutodismissal};
3637
3738
// Merge entityRef settings
3839
CRM.config.entityRef = $.extend({ldelim}{rdelim}, {$entityRef|@json_encode}, CRM.config.entityRef || {ldelim}{rdelim});

templates/CRM/common/notifications.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="crm-notification-container" style="display:none">
1+
<div id="crm-notification-container" role="alert" aria-live="assertive" aria-atomic=”true” style="display:none">
22
<div id="crm-notification-alert" class="#{ldelim}type{rdelim}">
33
<div class="icon ui-notify-close" title="{ts}close{/ts}"> </div>
44
<a class="ui-notify-cross ui-notify-close" href="#" title="{ts}close{/ts}">x</a>

0 commit comments

Comments
 (0)