Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions components/ILIAS/UI/src/Component/ViewControl/Sortation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string,string> $options
*/
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="{ID}">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"<!-- BEGIN aria_label --> aria-label="{ARIA_LABEL}"<!-- END aria_label --> aria-haspopup="true" aria-expanded="false" aria-controls="{ID_MENU}"><span class="label">{LABEL}</span><span class="caret"></span></button>
<button class="btn btn-default dropdown-toggle"
type="button"
data-toggle="dropdown"
<!-- BEGIN aria_label --> aria-label="{ARIA_LABEL}"<!-- END aria_label -->
<!-- BEGIN has_popup --> aria-haspopup="true"<!-- END has_popup -->
aria-expanded="false"
aria-controls="{ID_MENU}">
<span class="label">{LABEL}</span>
<span class="caret"></span>
</button>


<ul id="{ID_MENU}" class="dropdown-menu">
<!-- BEGIN option -->
Expand Down