mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-25 13:25:56 +00:00
Crude mitigation for out-of-bounds list indices when arrowing through ItemList
.
This commit is contained in:
parent
23fd884b2e
commit
6b0c920549
|
@ -106,6 +106,9 @@ func item_list_nothing_selected():
|
|||
TTS.speak("Nothing selected", true)
|
||||
|
||||
func item_list_input(event):
|
||||
if event.is_action_pressed("ui_right") or event.is_action_pressed("ui_left"):
|
||||
return node.accept_event()
|
||||
var old_count = node.get_item_count()
|
||||
var old_pos = position_in_children
|
||||
if event.is_action_pressed("ui_up"):
|
||||
node.accept_event()
|
||||
|
@ -124,6 +127,8 @@ func item_list_input(event):
|
|||
node.accept_event()
|
||||
position_in_children = node.get_item_count()-1
|
||||
if old_pos != position_in_children:
|
||||
if position_in_children >= node.get_item_count():
|
||||
position_in_children = 0
|
||||
node.unselect_all()
|
||||
node.select(position_in_children)
|
||||
item_list_item_focused(position_in_children)
|
||||
|
|
Loading…
Reference in New Issue
Block a user