Script Editor Focus Bug: Deleting Script Instead of Selected Text When Returning from Another Window

When using Roblox Studio, if a user opens a script via the Explorer and highlights something in the script editor, switches focus to another application (e.g., checking a to-do list), then returns to Roblox Studio by clicking on a dockable panel (such as Script Analysis, Find All/Replace All, Properties, etc.), keyboard input (e.g., Backspace) is incorrectly sent to the last selected item in the Explorer instead of the script editor. As a result, pressing Backspace deletes the entire script from the game hierarchy instead of deleting the selected text within the script. Other keystrokes are similarly disregarded by the editor.

If focus is instead returned to Roblox Studio by clicking the script editor window or the Studio’s top banner/header, the expected behavior resumes and keystrokes work within the script editor. This issue started after the recent UI update to the Explorer. The bug is particularly impactful for users with a single monitor who frequently switch between windows, as it can lead to accidental script deletion and loss of undo history on recovery.

Repro Steps:

  1. Open Roblox Studio.
  2. Open a script file using the Explorer.
  3. Highlight text within the script editor.
  4. Switch focus to a different application (e.g., another window).
  5. Return to Roblox Studio by clicking on a blank area of a dockable panel such as Script Analysis, Find All/Replace All, or Properties (not the script editor or top banner).
  6. Press Backspace on the keyboard.
  7. Observe: The script itself is deleted in the Explorer, rather than the text being deleted in the script editor. Undo history is also lost if you restore the script.

Video Example