Skip to content

Commit

Permalink
[FIX] UI #37151: add aria-expanded attribute to metabar more-button (I…
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen authored Sep 28, 2023
1 parent 89d5577 commit 89cc751
Show file tree
Hide file tree
Showing 10 changed files with 755 additions and 328 deletions.
23 changes: 13 additions & 10 deletions src/UI/Implementation/Component/MainControls/Renderer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\Implementation\Component\MainControls;

use ILIAS\UI\Component;
Expand Down Expand Up @@ -103,7 +103,7 @@ protected function renderToolEntry(
$this->trigger_signals[] = $trigger_signal;
$btn_removetool = $close_buttons[$entry_id]
->withAdditionalOnloadCode(
fn ($id) => "il.UI.maincontrols.mainbar.addPartIdAndEntry('$mb_id', 'remover', '$id', true);"
fn($id) => "il.UI.maincontrols.mainbar.addPartIdAndEntry('$mb_id', 'remover', '$id', true);"
)
->withOnClick($trigger_signal);

Expand Down Expand Up @@ -268,13 +268,16 @@ function ($id) use ($signals) {
$entry_signal = $signals['entry'];
$close_slates_signal = $signals['close_slates'];
return "
il.UI.maincontrols.metabar.registerSignals(
'$id',
il.UI.maincontrols.metabar.init('$id');
il.UI.maincontrols.metabar.get('$id').registerSignals(
'$entry_signal',
'$close_slates_signal',
);
il.UI.maincontrols.metabar.init();
$(window).resize(il.UI.maincontrols.metabar.init);
il.UI.maincontrols.metabar.get('$id').init();
window.addEventListener(
'resize',
()=>{il.UI.maincontrols.metabar.get('$id').init()}
);
";
}
);
Expand Down Expand Up @@ -321,13 +324,13 @@ protected function renderSystemInfo(
$close = $close->withOnClick($signal);
$tpl->setVariable('CLOSE_BUTTON', $default_renderer->render($close));
$tpl->setVariable('CLOSE_URI', (string) $component->getDismissAction());
$component = $component->withAdditionalOnLoadCode(fn ($id) => "$(document).on('$signal', function() { il.UI.maincontrols.system_info.close('$id'); });");
$component = $component->withAdditionalOnLoadCode(fn($id) => "$(document).on('$signal', function() { il.UI.maincontrols.system_info.close('$id'); });");
}

$more = $this->getUIFactory()->symbol()->glyph()->more("#");
$tpl->setVariable('MORE_BUTTON', $default_renderer->render($more));

$component = $component->withAdditionalOnLoadCode(fn ($id) => "il.UI.maincontrols.system_info.init('$id')");
$component = $component->withAdditionalOnLoadCode(fn($id) => "il.UI.maincontrols.system_info.init('$id')");

$id = $this->bindJavaScript($component);
$tpl->setVariable('ID', $id);
Expand Down Expand Up @@ -454,7 +457,7 @@ public function registerResources(ResourceRegistry $registry): void
{
parent::registerResources($registry);
$registry->register('./src/UI/templates/js/MainControls/dist/mainbar.js');
$registry->register('./src/UI/templates/js/MainControls/metabar.js');
$registry->register('./src/UI/templates/js/MainControls/dist/maincontrols.min.js');
$registry->register('./src/GlobalScreen/Client/dist/GS.js');
$registry->register('./src/UI/templates/js/MainControls/system_info.js');
}
Expand Down
14 changes: 10 additions & 4 deletions src/UI/Implementation/Component/MainControls/Slate/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function getCombinedSlateContents(
$triggerer = $triggerer
->withOnClick($trigger_signal)
->withAdditionalOnLoadCode(
fn ($id) => "
fn($id) => "
il.UI.maincontrols.mainbar.addTriggerSignal('{$trigger_signal}');
il.UI.maincontrols.mainbar.addPartIdAndEntry('{$mb_id}', 'triggerer', '{$id}');
"
Expand Down Expand Up @@ -132,9 +132,15 @@ protected function renderSlate(

$component = $component->withAdditionalOnLoadCode(
function ($id) use ($slate_signals, $mb_id): string {
$js = "fn = il.UI.maincontrols.slate.onSignal;";
$js = "";
foreach ($slate_signals as $key => $signal) {
$js .= "$(document).on('{$signal}', function(event, signalData) { fn('{$key}', event, signalData, '{$id}'); return false;});";
$js .= "$(document).on('{$signal}', function(event, signalData) {
il.UI.maincontrols.slate.onSignal('{$key}',
event,
signalData,
'{$id}'
);
return false;});";
}

if ($mb_id) {
Expand Down Expand Up @@ -168,7 +174,7 @@ protected function renderNotificationSlate(
public function registerResources(\ILIAS\UI\Implementation\Render\ResourceRegistry $registry): void
{
parent::registerResources($registry);
$registry->register('./src/UI/templates/js/MainControls/slate.js');
$registry->register('./src/UI/templates/js/MainControls/dist/maincontrols.min.js');
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/UI/templates/js/MainControls/dist/maincontrols.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

216 changes: 0 additions & 216 deletions src/UI/templates/js/MainControls/metabar.js

This file was deleted.

Loading

0 comments on commit 89cc751

Please sign in to comment.