From 4ce3d5d9f2b5d53796605e9c87e773cc9fbfcee5 Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Mon, 26 Jan 2026 15:41:13 +0100 Subject: [PATCH 1/3] [Fix] #004698 UI: Add role for glyphs without href --- .../Implementation/Component/Symbol/Glyph/Renderer.php | 10 ++++++++++ .../default/Symbol/tpl.glyph.context_btn.html | 2 +- .../templates/default/Symbol/tpl.glyph.standard.html | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php index 83195849394c..9f0e3b35147e 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php @@ -67,6 +67,16 @@ public function render(Component\Component $component, RendererInterface $defaul $tpl->parseCurrentBlock(); } + $has_action = $component->isActive() && ($component->getAction() !== ''); + $is_clickable = $component->isTabbable() || ($component instanceof Component\Triggerer && count($component->getTriggeredSignals()) > 0); + + if (!$has_action) { + $role = $is_clickable ? 'button' : 'img'; + $tpl->setCurrentBlock("with_role"); + $tpl->setVariable("ROLE", $role); + $tpl->parseCurrentBlock(); + } + $tpl = $this->renderLabel($component, $tpl); $id = $this->bindJavaScript($component); diff --git a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html index c36bf807c5c1..fbde6217c88f 100755 --- a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html +++ b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html @@ -1,3 +1,3 @@ - aria-disabled="{ARIA_DISABLED}" aria-label="{LABEL}" role="img" id="{ID}"> + aria-disabled="{ARIA_DISABLED}" aria-label="{LABEL}" role="{ROLE}" id="{ID}"> {GLYPH} diff --git a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.standard.html b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.standard.html index 7da77fabbc12..607c04cf017a 100755 --- a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.standard.html +++ b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.standard.html @@ -1,3 +1,3 @@ -tabindex="0" class="glyph highlighted disabled" href="{ACTION}" aria-label="{LABEL}" aria-disabled="{ARIA_DISABLED}" id="{ID}"> + tabindex="0" class="glyph highlighted disabled" href="{ACTION}" aria-label="{LABEL}" aria-disabled="{ARIA_DISABLED}" role="{ROLE}" id="{ID}"> {GLYPH} From c486a9e4aaa4020ebf982be1638fb0aa6ab2c8b0 Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Tue, 27 Jan 2026 14:33:18 +0100 Subject: [PATCH 2/3] [Fix] #004698 UI: Fix Unit Tests --- .../Symbol/Glyph/ButtonContextRenderer.php | 5 ++++ .../Component/Symbol/Glyph/Renderer.php | 26 ++++++++++++------- .../default/Symbol/tpl.glyph.context_btn.html | 2 +- .../UI/tests/Component/Entity/EntityTest.php | 6 ++--- .../Container/Filter/StandardFilterTest.php | 16 ++++++------ .../Component/Symbol/Glyph/GlyphTest.php | 10 +++---- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/ButtonContextRenderer.php b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/ButtonContextRenderer.php index 53a023c61f8f..42a6191e52d9 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/ButtonContextRenderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/ButtonContextRenderer.php @@ -53,4 +53,9 @@ protected function renderLabel(Component\Component $component, Template $tpl): T return $tpl; } + + public function renderRole(Component\Component $component, Template $tpl): Template + { + return $tpl; + } } diff --git a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php index 9f0e3b35147e..fba5201b35b2 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/Symbol/Glyph/Renderer.php @@ -67,16 +67,7 @@ public function render(Component\Component $component, RendererInterface $defaul $tpl->parseCurrentBlock(); } - $has_action = $component->isActive() && ($component->getAction() !== ''); - $is_clickable = $component->isTabbable() || ($component instanceof Component\Triggerer && count($component->getTriggeredSignals()) > 0); - - if (!$has_action) { - $role = $is_clickable ? 'button' : 'img'; - $tpl->setCurrentBlock("with_role"); - $tpl->setVariable("ROLE", $role); - $tpl->parseCurrentBlock(); - } - + $tpl= $this->renderRole($component, $tpl); $tpl = $this->renderLabel($component, $tpl); $id = $this->bindJavaScript($component); @@ -108,6 +99,21 @@ protected function renderAction(Component\Component $component, Template $tpl): return $tpl; } + public function renderRole(Component\Component $component, Template $tpl): Template + { + $has_action = $component->isActive() && ($component->getAction() !== null); + $is_clickable = $component->isTabbable() || ($component instanceof Component\Triggerer && count($component->getTriggeredSignals()) > 0); + + if (!$has_action) { + $role = $is_clickable ? 'button' : 'img'; + $tpl->setCurrentBlock("with_role"); + $tpl->setVariable("ROLE", $role); + $tpl->parseCurrentBlock(); + } + + return $tpl; + } + protected function getInnerGlyphHTML(Component\Component $component, RendererInterface $default_renderer): string { $tpl = $this->getTemplate('tpl.glyph.html', true, true); diff --git a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html index fbde6217c88f..c36bf807c5c1 100755 --- a/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html +++ b/components/ILIAS/UI/src/templates/default/Symbol/tpl.glyph.context_btn.html @@ -1,3 +1,3 @@ - aria-disabled="{ARIA_DISABLED}" aria-label="{LABEL}" role="{ROLE}" id="{ID}"> + aria-disabled="{ARIA_DISABLED}" aria-label="{LABEL}" role="img" id="{ID}"> {GLYPH} diff --git a/components/ILIAS/UI/tests/Component/Entity/EntityTest.php b/components/ILIAS/UI/tests/Component/Entity/EntityTest.php index 0a2f36d9088e..a58dd004c0c8 100755 --- a/components/ILIAS/UI/tests/Component/Entity/EntityTest.php +++ b/components/ILIAS/UI/tests/Component/Entity/EntityTest.php @@ -161,11 +161,11 @@ public function testEntityRendering(): void
a
d
- - + +
diff --git a/components/ILIAS/UI/tests/Component/Input/Container/Filter/StandardFilterTest.php b/components/ILIAS/UI/tests/Component/Input/Container/Filter/StandardFilterTest.php index 99f20a3d5fbc..a6c9dadc23f3 100755 --- a/components/ILIAS/UI/tests/Component/Input/Container/Filter/StandardFilterTest.php +++ b/components/ILIAS/UI/tests/Component/Input/Container/Filter/StandardFilterTest.php @@ -184,12 +184,12 @@ public function testRenderActivatedCollapsed(): void