Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subcategory entries are still clickable after being filtered out by the search bar #245

Open
Estecka opened this issue Feb 23, 2024 · 0 comments

Comments

@Estecka
Copy link

Estecka commented Feb 23, 2024

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
2024-02-23_01 34 02

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();
	}
}
  1. Make a mod with this screen using the method of your choice. (I'm using ModMenu)
  2. Type "1" in the search bar. This will filter out roughly half of the entries.
  3. Try toggling all visible entries exactly once. You should only be able to toggle entry 10.
  4. You should be able to find some clickable areas on the backgorund past the last visible entries.
  5. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant