         element.vars[FILENAME_VAR] = fileName;
         element.vars[MODIFIED_VAR] = false;
 
-        // Does not allow UI subsystem to reorder children while editing the element in the editor
-        element.sortChildren = false;
+        // Do not allow UI subsystem to reorder children while editing the element in the editor
+        ResetSortChildren(element);
 
         editorUIElement.AddChild(element);
 

    if (editUIElement.LoadXML(xmlFile, uiElementDefaultStyle !is null ? uiElementDefaultStyle : uiStyle))
    {
        UIElement@ element = editUIElement.children[editUIElement.numChildren - 1];
        UpdateHierarchyItem(element);

        // Create an undo action for the load

    return true;
}

void ResetSortChildren(UIElement@ element)
{
    element.sortChildren = false;

    // Perform the action recursively for child elements
    for (uint i = 0; i < element.numChildren; ++i)
        ResetSortChildren(element.children[i]);
}

void OpenUIElement(const String&in fileName)
{
    if (fileName.empty)
