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

ItemList: Disabled items still trigger selection and activation signals on mouse #74086

Closed
PunchablePlushie opened this issue Feb 27, 2023 · 0 comments · Fixed by #74250
Closed

Comments

@PunchablePlushie
Copy link

Godot version

4.0.rc6

System information

Windows 10

Issue description

Disabled items of an ItemList still trigger item_selected and item_activated signals when using the mouse. Even though the documentation states that:

Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing Enter).

Visually, they are as expected (grayed out and can't grab focus).


This seems to be a recurring problem as it has happened in Godot 2 (#5683) and Godot 3 (#37277) as well.
According to the comments in #37277, PR #37285 (#60123) is supposed to fix it for Godot 4. But it still seems to be an issue.

The PR suggests using disabled for rendering and selectable for actual selection. If that's the final verdict on the matter, then the documentation should be updated to reflect this.

Steps to reproduce

  1. Create a simple scene.
  2. Add an ItemList and add several items to it via the Inspector. Disable one or more items.
  3. Attach a script to the item list with the following code:
extends ItemList


func _ready() -> void:
	item_activated.connect(_on_item_activated)
	item_selected.connect(_on_item_selected)


func _on_item_activated(item_index: int) -> void:
	prints("Item Activated:", item_index)


func _on_item_selected(item_index: int) -> void:
	prints("Item Selected:", item_index)
  1. Run the project and try selecting/activating a disabled item.
  2. Check the Output console for results.

Minimal reproduction project

ItemList_DisabledItem_Bug.zip

@YuriSizov YuriSizov added this to the 4.1 milestone Mar 21, 2023
@YuriSizov YuriSizov changed the title 4.0 RC 6 - ItemList: Disabled items still trigger selection and activation signals on mouse ItemList: Disabled items still trigger selection and activation signals on mouse Mar 21, 2023
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 19, 2023
mandryskowski pushed a commit to mandryskowski/godot that referenced this issue Oct 11, 2023
…g signals

disabled -> not sending any signal at all (activated, selected, deselected, ...)
selected -> only possible when not disabled, and when selectable

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

Successfully merging a pull request may close this issue.

4 participants