Capturing focus of TextBox in plugin widget does not focus widget

Issue Type: Display
Impact: High
Frequency: Constantly
Date First Experienced: 2021-05-10 00:05:00 (+00:00)
Date Last Experienced: 2021-05-10 00:05:00 (+00:00)

Reproduction Steps:

  1. Create a DockWidgetPluginGui.
  2. Create a TextBox within the widget.
  3. Call TextBox:CaptureFocus().

Reproduction plugin script (save as TestFocus.lua in local plugins folder):

local panel = plugin:CreateDockWidgetPluginGui(
	"TestFocusPanel",
	DockWidgetPluginGuiInfo.new(
		Enum.InitialDockState.Float,
		false, -- initEnabled
		true,  -- overrideEnabledRestore
		100, 100, -- floatSize
		100, 100  -- minSize
	)
)

local textbox = Instance.new("TextBox")
textbox.Size = UDim2.new(1,0,1,0)
textbox.Text = "Text"
textbox.Font = Enum.Font.SourceSans
textbox.TextSize = 14
textbox.TextXAlignment = Enum.TextXAlignment.Left
textbox.ClearTextOnFocus = false
textbox.Parent = panel

panel.Name = "TestFocusPanel"
panel.Title = "Test Focus"
panel.Enabled = true

textbox.Focused:Connect(function()
	print("TEXTBOX FOCUSED")
end)

textbox.FocusLost:Connect(function()
	print("TEXTBOX BLURRED")
end)

panel.WindowFocused:Connect(function()
	print("WINDOW FOCUSED")
end)

panel.WindowFocusReleased:Connect(function()
	print("WINDOW BLURRED")
end)

print("CAPTURING FOCUS...")
wait(3)
textbox:CaptureFocus()

Expected Behavior:
When TextBox:CaptureFocus() is called to focus the TextBox, the widget containing the TextBox is also focused.

Actual Behavior:
While the TextBox is correctly focused, the widget is not, preventing input to the TextBox.

Workaround:

6 Likes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

9 Likes

I’m experiencing this bug. This seems like a common bug.
Any update?

2 Likes