Prior to 12/10/2024, a popular library called Cmdr (Cmdr) had an auto-complete function that allowed the user to select an auto-fill option using the arrow keys and press Tab to fill it into the command box. However, after 12/10/2024, this functionality stopped working and Cmdr would always autofill the top option in the list. Cmdr has not been updated since 7/9/2023.
You can see it autofilling the wrong option here:
Cmdr relies on this method to sink the Tab input:
Entry.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
Gui.CanvasPosition = Vector2.new(0, Gui.AbsoluteCanvasSize.Y)
if Entry.TextBox.Text:match("\t") then -- Eat \t
Entry.TextBox.Text = Entry.TextBox.Text:gsub("\t", "")
return
end
if Window.OnTextChanged then
return Window.OnTextChanged(Entry.TextBox.Text)
end
end)
https://github.com/evaera/Cmdr/blob/master/Cmdr/CmdrClient/CmdrInterface/Window.lua#L323-L333
Using debug prints, we can see that when TextBox.Text
is assigned, the :GetPropertyChangedSignal("Text")
connection will immediately fire and will yield execution of the original connection execution until the child execution is complete.
Extracted out to a minimal repro, we can see this with a simple TextBox and LocalScript:
local callback = function()
print("Here is the text:", script.Parent.Text)
end
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
print(`Detected text property changed: '{script.Parent.Text}'`)
if script.Parent.Text:match("\t") then
print("Will remove '\t'")
script.Parent.Text = script.Parent.Text:gsub("\t", "")
print("Did remove '\t'")
return
end
if callback then
callback()
end
end)
Gives these logs indicating the same behavior as Cmdr:
11:44:42.361 Detected text property changed: '' - Client - LocalScript:6
11:44:42.362 Here is the text: - Client - LocalScript:2
11:44:42.922 Detected text property changed: 'a' - Client - LocalScript:6
11:44:42.922 Here is the text: a - Client - LocalScript:2
11:44:43.763 Detected text property changed: 'a ' - Client - LocalScript:6
11:44:43.764 Will remove ' ' - Client - LocalScript:9
11:44:43.764 Did remove ' ' - Client - LocalScript:11
11:44:43.764 Detected text property changed: 'a' - Client - LocalScript:6
11:44:43.764 Here is the text: a - Client - LocalScript:2
This only started happening late in the afternoon (PST) on 12/10/2024.
Minimal repro can be found here:
Place1.rbxl (116.6 KB)