Skip to content

Commit d622a91

Browse files
authored
[5.4] Stats plugin accessibility (joomla#45736)
Signed-off-by: BrianTeeman <[email protected]>
1 parent 5cda4c8 commit d622a91

File tree

6 files changed

+15
-35
lines changed

6 files changed

+15
-35
lines changed

build/media_source/plg_system_stats/js/stats-message.es6.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ Joomla = window.Joomla || {};
2525
const initStatsEvents = (callback) => {
2626
const messageContainer = document.getElementById('system-message-container');
2727
const joomlaAlert = messageContainer.querySelector('.js-pstats-alert');
28-
const detailsContainer = messageContainer.querySelector('#js-pstats-data-details');
29-
30-
// Show details about the information being sent
31-
document.addEventListener('click', (event) => {
32-
if (event.target.classList.contains('js-pstats-btn-details')) {
33-
event.preventDefault();
34-
detailsContainer.classList.toggle('d-none');
35-
}
36-
});
3728

3829
// Always allow
3930
document.addEventListener('click', (event) => {

build/media_source/plg_system_stats/js/stats.es6.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,16 @@
77
'use strict';
88

99
// Selectors used by this script
10-
const statsDataTogglerId = 'js-pstats-data-details-toggler';
11-
const statsDataDetailsId = 'js-pstats-data-details';
1210
const resetId = 'js-pstats-reset-uid';
1311
const uniqueIdFieldId = 'jform_params_unique_id';
1412

15-
const onToggle = (event) => {
16-
event.preventDefault();
17-
const element = document.getElementById(statsDataDetailsId);
18-
19-
if (element) {
20-
element.classList.toggle('d-none');
21-
}
22-
};
23-
2413
const onReset = (event) => {
2514
event.preventDefault();
2615
document.getElementById(uniqueIdFieldId).value = '';
2716
Joomla.submitbutton('plugin.apply');
2817
};
2918

3019
const onBoot = () => {
31-
// Toggle stats details
32-
const toggler = document.getElementById(statsDataTogglerId);
33-
if (toggler) {
34-
toggler.addEventListener('click', onToggle);
35-
}
36-
3720
// Reset the unique id
3821
const reset = document.getElementById(resetId);
3922
if (reset) {

build/media_source/system/js/core.es6.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const DefaultAllowlist = {
5353
select: ['name'],
5454
textarea: ['name'],
5555
option: ['value', 'selected'],
56+
details: ['open'],
57+
summary: [],
5658
};
5759

5860
// Only define the Joomla namespace if not defined.

plugins/system/stats/layouts/field/data.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
*/
5151
?>
5252
<?php if (count($statsData)) : ?>
53-
<a href="#" id="js-pstats-data-details-toggler"><?php echo Text::_('PLG_SYSTEM_STATS_MSG_WHAT_DATA_WILL_BE_SENT'); ?></a>
54-
<?php echo $field->render('stats', compact('statsData')); ?>
53+
<details>
54+
<summary>
55+
<?php echo Text::_('PLG_SYSTEM_STATS_MSG_WHAT_DATA_WILL_BE_SENT'); ?>
56+
</summary>
57+
<?php echo $field->render('stats', compact('statsData')); ?>
58+
</details>
5559
<?php endif; ?>

plugins/system/stats/layouts/message.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
<p>
3232
<?php echo Text::_('PLG_SYSTEM_STATS_MSG_JOOMLA_WANTS_TO_SEND_DATA'); ?>
3333
</p>
34-
<p>
35-
<a href="#" class="js-pstats-btn-details alert-link"><?php echo Text::_('PLG_SYSTEM_STATS_MSG_WHAT_DATA_WILL_BE_SENT'); ?></a>
36-
</p>
37-
<?php
38-
echo $plugin->render('stats', compact('statsData'));
39-
?>
34+
<details>
35+
<summary>
36+
<?php echo Text::_('PLG_SYSTEM_STATS_MSG_WHAT_DATA_WILL_BE_SENT'); ?>
37+
</summary>
38+
<?php echo $plugin->render('stats', compact('statsData')); ?>
39+
</details>
4040
<p class="fw-bold"><?php echo Text::_('PLG_SYSTEM_STATS_MSG_ALLOW_SENDING_DATA'); ?></p>
4141
<p class="actions">
4242
<button type="button" class="btn btn-primary js-pstats-btn-allow-never"><?php echo Text::_('PLG_SYSTEM_STATS_BTN_NEVER_SEND'); ?></button>

plugins/system/stats/layouts/stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
$versionFields = ['php_version', 'db_version', 'cms_version'];
2424
?>
25-
<table class="table mb-3 d-none" id="js-pstats-data-details">
25+
<table class="table mb-3">
2626
<caption class="visually-hidden">
2727
<?php echo Text::_('PLG_SYSTEM_STATS_STATISTICS'); ?>
2828
</caption>

0 commit comments

Comments
 (0)