Skip to content

Commit 49f9cba

Browse files
committed
Force the category selection to take up at least 3 rows
This prevent some strange UI presented by the browser for `size="1"`. See https://www.woltlab.com/community/thread/314822/
1 parent 22a2627 commit 49f9cba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wcfsetup/install/files/lib/system/condition/AbstractMultiCategoryCondition.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ protected function getFieldElement()
3838
$categoryTree = (new $this->nodeTreeClassname($this->objectType))->getIterator();
3939
$categoryCount = \iterator_count($categoryTree);
4040

41-
$fieldElement = '<select name="' . $this->fieldName . '[]" id="' . $this->fieldName . '" multiple size="' . ($categoryCount >= 10 ? 10 : $categoryCount) . '">';
41+
$size = \min(\max($categoryCount, 10), 3);
42+
$fieldElement = '<select name="' . $this->fieldName . '[]" id="' . $this->fieldName . '" multiple size="' . $size . '">';
4243
/** @var CategoryNode $categoryNode */
4344
foreach ($categoryTree as $categoryNode) {
4445
$fieldElement .= "<option value=\"{$categoryNode->categoryID}\"" . (\in_array(

0 commit comments

Comments
 (0)