From 14f096833af5a77fb7bf239fe4ed638a57b49ec5 Mon Sep 17 00:00:00 2001 From: Satyam Mangroliya Date: Tue, 7 Oct 2025 15:38:19 +0200 Subject: [PATCH] fix/43788-removed-aria-haspopup-on-the-control-element --- .../Presentation/AttemptResultsTable.php | 6 +++++- .../UI/src/Component/ViewControl/Sortation.php | 6 ++++++ .../Component/ViewControl/Renderer.php | 5 +++++ .../Component/ViewControl/Sortation.php | 18 ++++++++++++++++++ .../default/ViewControl/tpl.sortation.html | 12 +++++++++++- 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/components/ILIAS/Test/src/Results/Presentation/AttemptResultsTable.php b/components/ILIAS/Test/src/Results/Presentation/AttemptResultsTable.php index 19236827b766..7abfce98eaaf 100644 --- a/components/ILIAS/Test/src/Results/Presentation/AttemptResultsTable.php +++ b/components/ILIAS/Test/src/Results/Presentation/AttemptResultsTable.php @@ -168,11 +168,15 @@ private function getViewControls( ]; $pre = implode(URLBuilder::SEPARATOR, $this->getViewControlNamespace()) . URLBuilder::SEPARATOR; - $vc_sort = $ui_factory->viewControl()->sortation($options, $sortation)->withTargetURL( + $vc_sort = $ui_factory->viewControl() + ->sortation($options, $sortation) + ->withHasPopup(false) // removed aria-haspopup + ->withTargetURL( $target->buildURI()->__toString(), $pre . self::PARAM_SORT ); + return [ $vc_mode, $vc_sort diff --git a/components/ILIAS/UI/src/Component/ViewControl/Sortation.php b/components/ILIAS/UI/src/Component/ViewControl/Sortation.php index 03fc1cc8f3a6..519b3ad77af2 100755 --- a/components/ILIAS/UI/src/Component/ViewControl/Sortation.php +++ b/components/ILIAS/UI/src/Component/ViewControl/Sortation.php @@ -75,4 +75,10 @@ public function getSelectSignal(): Signal; * Set the selected option. */ public function withSelected(string $selected_option): self; + + + + /** NEW: default true (backward compatible) */ + public function withHasPopup(bool $has_popup): self; + public function hasPopup(): bool; } diff --git a/components/ILIAS/UI/src/Implementation/Component/ViewControl/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/ViewControl/Renderer.php index 06579b16f89c..0d945f409b0a 100644 --- a/components/ILIAS/UI/src/Implementation/Component/ViewControl/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/ViewControl/Renderer.php @@ -161,6 +161,11 @@ protected function renderSortation( $tpl->setVariable("ID", $id); $tpl->setVariable("ID_MENU", $id . '_ctrl'); + /* NEW: control aria-haspopup via template block */ + if ($component->hasPopup()) { + $tpl->touchBlock('has_popup'); + } + $options = $component->getOptions(); $items = []; diff --git a/components/ILIAS/UI/src/Implementation/Component/ViewControl/Sortation.php b/components/ILIAS/UI/src/Implementation/Component/ViewControl/Sortation.php index 38441a87b8e3..885fae485790 100755 --- a/components/ILIAS/UI/src/Implementation/Component/ViewControl/Sortation.php +++ b/components/ILIAS/UI/src/Implementation/Component/ViewControl/Sortation.php @@ -39,6 +39,9 @@ class Sortation implements C\ViewControl\Sortation protected string $parameter_name = "sortation"; protected ?string $active = null; + /** NEW: default = true for BC */ + private bool $has_popup = true; + /** * @param array $options */ @@ -152,4 +155,19 @@ public function getSelected(): ?string { return $this->selected; } + + + /** NEW */ + public function withHasPopup(bool $has_popup): self + { + $clone = clone $this; + $clone->has_popup = $has_popup; + return $clone; + } + + /** NEW */ + public function hasPopup(): bool + { + return $this->has_popup; + } } diff --git a/components/ILIAS/UI/src/templates/default/ViewControl/tpl.sortation.html b/components/ILIAS/UI/src/templates/default/ViewControl/tpl.sortation.html index d8bf0e2ed9b5..2d02ef3579df 100755 --- a/components/ILIAS/UI/src/templates/default/ViewControl/tpl.sortation.html +++ b/components/ILIAS/UI/src/templates/default/ViewControl/tpl.sortation.html @@ -1,5 +1,15 @@