diff --git a/components/ILIAS/GlobalScreen/src/Scope/Tool/Collector/Renderer/TreeToolItemRenderer.php b/components/ILIAS/GlobalScreen/src/Scope/Tool/Collector/Renderer/TreeToolItemRenderer.php index 77508d01dd74..7f63b188c14c 100755 --- a/components/ILIAS/GlobalScreen/src/Scope/Tool/Collector/Renderer/TreeToolItemRenderer.php +++ b/components/ILIAS/GlobalScreen/src/Scope/Tool/Collector/Renderer/TreeToolItemRenderer.php @@ -23,6 +23,8 @@ use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\BaseTypeRenderer; use ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem; use ILIAS\UI\Component\Component; +use ILIAS\GlobalScreen\Scope\Tool\Factory\TreeTool; +use ILIAS\UI\Implementation\Component\MainControls\Slate\Slate; /** * Class TreeToolItemRenderer @@ -45,6 +47,12 @@ public function getComponentForItem(isItem $item, bool $with_content = false): C $symbol = $this->getStandardSymbol($item); - return $this->ui_factory->mainControls()->slate()->legacy($item->getTitle(), $symbol, $this->ui_factory->legacy()->content($DIC->ui()->renderer()->render([$item->getTree()]))); + $slate = $this->ui_factory->mainControls()->slate()->legacy( + $item->getTitle(), + $symbol, + $this->ui_factory->legacy()->content($DIC->ui()->renderer()->render([$item->getTree()])) + ); + + return $slate->withAriaRole(Slate::GROUP); } } diff --git a/components/ILIAS/Style/System/classes/Provider/SystemStylesGlobalScreenToolProvider.php b/components/ILIAS/Style/System/classes/Provider/SystemStylesGlobalScreenToolProvider.php index 747047e58a98..ef496ae4c8e5 100755 --- a/components/ILIAS/Style/System/classes/Provider/SystemStylesGlobalScreenToolProvider.php +++ b/components/ILIAS/Style/System/classes/Provider/SystemStylesGlobalScreenToolProvider.php @@ -19,7 +19,7 @@ declare(strict_types=1); use ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider; -use ILIAS\GlobalScreen\Scope\Tool\Factory\Tool; +use ILIAS\GlobalScreen\Scope\Tool\Factory\TreeTool; use ILIAS\UI\Component\Tree\Tree; use ILIAS\UI\Implementation\Crawler\Entry\ComponentEntries as Entries; use ILIAS\Data\URI; @@ -55,7 +55,7 @@ public function getToolsForContextStack( return []; } - protected function buildTreeAsTool(): Tool + protected function buildTreeAsTool(): TreeTool { $id_generator = function ($id) { return $this->identification_provider->contextAwareIdentifier($id); @@ -64,14 +64,11 @@ protected function buildTreeAsTool(): Tool $title = $this->dic->language()->txt('documentation'); $icon = $this->dic->ui()->factory()->symbol()->icon()->standard('stys', $title); - /** - * @Todo, replace this with a proper Tree Slate - */ return $this->factory - ->tool($id_generator('system_styles_tree')) + ->treeTool($id_generator('system_styles_tree')) ->withTitle($title) ->withSymbol($icon) - ->withContent($this->dic->ui()->factory()->legacy()->content($this->dic->ui()->renderer()->render($this->getUITree()))); + ->withTree($this->getUITree()); } protected function getUITree(): Tree diff --git a/components/ILIAS/Style/System/test/Provider/SystemStylesGlobalScreenToolProviderTest.php b/components/ILIAS/Style/System/test/Provider/SystemStylesGlobalScreenToolProviderTest.php index 6793e6bfac71..1ecb3fcf2ca9 100755 --- a/components/ILIAS/Style/System/test/Provider/SystemStylesGlobalScreenToolProviderTest.php +++ b/components/ILIAS/Style/System/test/Provider/SystemStylesGlobalScreenToolProviderTest.php @@ -22,14 +22,13 @@ include_once('./components/ILIAS/UI/tests/UITestHelper.php'); use PHPUnit\Framework\TestCase; - use ILIAS\UI\Implementation\Crawler\Entry\ComponentEntry as Entry; use ILIAS\UI\Implementation\Crawler\Entry\ComponentEntries as Entries; use ILIAS\Data\URI; use ILIAS\DI\Container; use ILIAS\GlobalScreen\Identification\IdentificationFactory; use ILIAS\GlobalScreen\Provider\ProviderFactory; -use ILIAS\GlobalScreen\Scope\Tool\Factory\Tool; +use ILIAS\GlobalScreen\Scope\Tool\Factory\TreeTool; use ILIAS\GlobalScreen\ScreenContext\ContextRepository; use ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts; @@ -108,7 +107,7 @@ public function testBuildTreeAsToolIfInAdminstrationContextAndTreeIsAvailable(): $tools = $this->tool_provider->getToolsForContextStack($contexts); $this->assertCount(1, $tools); $tool = array_pop($tools); - $this->assertInstanceOf(Tool::class, $tool); + $this->assertInstanceOf(TreeTool::class, $tool); $this->assertEquals('documentation', $tool->getTitle()); } } diff --git a/components/ILIAS/UI/src/Component/MainControls/Slate/Slate.php b/components/ILIAS/UI/src/Component/MainControls/Slate/Slate.php index e18817c01063..c1197e9f4e8a 100755 --- a/components/ILIAS/UI/src/Component/MainControls/Slate/Slate.php +++ b/components/ILIAS/UI/src/Component/MainControls/Slate/Slate.php @@ -84,4 +84,6 @@ public function appendOnInView(Signal $signal): Slate; public function withMainBarTreePosition(string $tree_pos): Slate; public function getMainBarTreePosition(): ?string; + + public function getAriaRole(): ?string; } diff --git a/components/ILIAS/UI/src/Implementation/Component/MainControls/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/MainControls/Renderer.php index 3090a385c6c7..d5ed4ae941a7 100755 --- a/components/ILIAS/UI/src/Implementation/Component/MainControls/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/MainControls/Renderer.php @@ -166,7 +166,9 @@ function ($id) use ($js, $mb_id, $k, $is_tool): string { $tpl->parseCurrentBlock(); if ($slate) { - $entry = $entry->withAriaRole(ISlate::MENU); + if ($entry->getAriaRole() === null) { + $entry = $entry->withAriaRole(ISlate::MENU); + } $tpl->setCurrentBlock("slate_item"); $tpl->setVariable("SLATE", $default_renderer->render($entry)); diff --git a/components/ILIAS/UI/src/Implementation/Component/MainControls/Slate/Slate.php b/components/ILIAS/UI/src/Implementation/Component/MainControls/Slate/Slate.php index 2bc23e8ae1ea..3206b5a9f8f9 100755 --- a/components/ILIAS/UI/src/Implementation/Component/MainControls/Slate/Slate.php +++ b/components/ILIAS/UI/src/Implementation/Component/MainControls/Slate/Slate.php @@ -40,12 +40,14 @@ abstract class Slate implements ISlate\Slate // allowed ARIA roles public const MENU = 'menu'; + public const GROUP = 'group'; /** * @var string[] */ protected static array $allowed_aria_roles = array( - self::MENU + self::MENU, + self::GROUP ); protected string $name; diff --git a/components/ILIAS/UI/tests/Component/MainControls/Slate/SlateTest.php b/components/ILIAS/UI/tests/Component/MainControls/Slate/SlateTest.php index ffa3d36a4bf4..5fb4a74e7e8e 100755 --- a/components/ILIAS/UI/tests/Component/MainControls/Slate/SlateTest.php +++ b/components/ILIAS/UI/tests/Component/MainControls/Slate/SlateTest.php @@ -91,6 +91,13 @@ public function testWithAriaRole(Slate $slate): void } } + #[\PHPUnit\Framework\Attributes\Depends('testConstruction')] + public function testWithAriaRoleGroup(Slate $slate): void + { + $slate = $slate->withAriaRole(Slate::GROUP); + $this->assertEquals("group", $slate->getAriaRole()); + } + #[\PHPUnit\Framework\Attributes\Depends('testConstruction')] public function testWithAriaRoleIncorrect(Slate $slate): void {