Subcategory entries are still clickable after being filtered out by the search bar
Estecka opened this issue ยท 0 comments
Hi,
I have an issue that occurs when using the search field together with sub-categories: Entries that are being filtered out are still clickable, and will often overlap with other visible entries, causing the wrong entry to be modified when clicking one.
For example, here's how I interpret the details:
On the left is the config screen as it appears after searching for "1".
On the right is the would-be layout of the same screen if the search bar was empty
Entries in red on the right have been filtered out, but are still overlaped onto the left screen. Trying to click the red entries on the left will result in the corresponding entry on the right to be toggled instead. The red area of the background can also be used to toggle hidden entries.
Entries in green are those that are still visible on the left. They've been moved around, so they leave out holes through which entries on the left can be toggled.
Here is the config screen I'm using in this screenshot:
public class TestScreen
{
static public Screen createScreen(Screen parent){
final ConfigBuilder builder = ConfigBuilder.create();
final ConfigEntryBuilder entries = builder.entryBuilder();
final ConfigCategory main = builder.getOrCreateCategory(Text.literal("Main"));
final SubCategoryBuilder sub = entries.startSubCategory(Text.literal("Sub"));
for (int i=0; i<16; ++i){
Text name = Text.literal(String.valueOf(i));
var field = entries.startBooleanToggle(name, false).setDefaultValue(false);
sub.add(field.build());
}
sub.setExpanded(true);
main.addEntry(sub.build());
builder.setParentScreen(parent);
return builder.build();
}
}
- Make a mod with this screen using the method of your choice. (I'm using ModMenu)
- Type "1" in the search bar. This will filter out roughly half of the entries.
- Try toggling all visible entries exactly once. You should only be able to toggle entry 10.
- You should be able to find some clickable areas on the backgorund past the last visible entries.
- Clear the search bar. You should find some of the previously hidden entries have been toggled.
I'm only using one subcategory here, but things can get wilder when there are multiple involved. The result can vary widely depending on small things, like wether subcategories were unwrapped after or before using the search field.
Mod list:
- Minecraft 1.20.4
- Fabric Loader 0.15.7
- Fabric API 0.96.3
- Cloth-Config 13.0.121
- Modmenu 9.0.0
I've also reproduced this on Cloth v10 + MC1.19.4, where I'm currently developping.