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 trigger selection and activation signals on mouse #37277

Closed
YuriSizov opened this issue Mar 24, 2020 · 4 comments
Closed

Comments

@YuriSizov
Copy link
Contributor

Godot version:
3.2.1.stable

OS/device including version:
Windows 10

Issue description:
According to ItemList documentation setting an item disabled means:

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

However, when clicked with mouse, they can still trigger item_selected and item_activated signals. Visually such items appear disabled and they cannot be selected with keyboard either: pressing arrow keys does not move the selection if the next item is disabled. But on clicks they do react.

Selection itself never changes, and signals can be filtered with is_item_disabled. So, this may be an error in classref. The only similar issue I have found was related to 2.1 (#5683), which resulted in fixing item behaviour.

Steps to reproduce:

  1. Create a UI scene with an ItemList node.
  2. Create a similar script to fill ItemList with items and disable one:
extends Control

onready var item_list : ItemList = $ItemList

func _ready() -> void:
	item_list.clear()
	item_list.add_item("test item 1")
	item_list.add_item("test item 2")
	item_list.add_item("test item 3")
	item_list.add_item("test item 4")
	item_list.add_item("test item 5")
	
	item_list.set_item_disabled(2, true)
	
	item_list.connect("item_activated", self, "_on_item_activated")
	item_list.connect("item_selected", self, "_on_item_selected")

func _on_item_activated(item_index : int) -> void:
	print("item #" + str(item_index) + " was activated")

func _on_item_selected(item_index : int) -> void:
	print("item #" + str(item_index) + " was selected")
  1. Run the project, clicking on the disabled item still produces prints:

item #2 was selected
item #2 was activated

Minimal reproduction project:
bug-itemlist-disabled-activation.zip

@KoBeWi
Copy link
Member

KoBeWi commented May 7, 2022

Fixed by #60123

@KoBeWi KoBeWi closed this as completed May 7, 2022
Repository owner moved this from In Progress to Done in 4.x Priority Issues May 7, 2022
@goblinJoel
Copy link

Any chance of getting the fix in 3.x as well?

@TaphouseGames
Copy link

Seems like this is an issue again in godot 3.5

@KoBeWi
Copy link
Member

KoBeWi commented Oct 6, 2022

The fix was never backported, it's only in 4.0.

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

Successfully merging a pull request may close this issue.

6 participants