EditorGUI.Foldout: docs wrong?

I have created a very simple property drawer to test this:
I use the position passed into the property drawer to both draw a foldout, and to draw a box styled label.
The same position RECT is used to draw both, and I expected the result to look similar to the position as defined in the docs:
89232-editorguifoldout.png

Note that in this image (from Unity - Scripting API: EditorGUI.Foldout), the position.xMin is to the left of the triangle indicator.

However, my tests show the position differently! In this test, the position.XMin is to the RIGHT of the triangle indicator. So, it appears, the indicator is NOT actually drawn inside the specified position Rect.
89234-myeditorguifoldout.jpg

Below is the entirety of my test project. Can someone else confirm they get the same results, and/or explain what I’m misunderstanding?

TestMono.cs

using UnityEngine;

[System.Serializable]
public class PropTestClass
{
    string a;
}
public class TestMono : MonoBehaviour {
    public PropTestClass p;
}

Editor\ TestMonoPropertDrawer.cs

using UnityEngine;
using UnityEditor;

[CustomPropertyDrawer(typeof(PropTestClass))]
public class TestMonoPropertDrawer : PropertyDrawer
{
    
    bool showDetailsFlag;
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        Debug.Log("foldout position" + position.ToString());
        showDetailsFlag = EditorGUI.Foldout(position, showDetailsFlag, new GUIContent("test Label"), false);
        Debug.Log("box position" + position.ToString());
        EditorGUI.LabelField(position, GUIContent.none, GUI.skin.box);
    }
    public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
    {
        return 20;
    }
}

Edit: Both Debug.Log calls, in the property drawer, show the exact same position Rect value.

Well, it’s not entirely “wrong”. That’s because the Foldout behaves differently depending on the state of “EditorGUIUtility.hierarchyMode”. If hierarchyMode is true it adds the padding of the foldoutstyle to the left of the given position. If it’s false it does not. The following lines are right at the beginning of the Foldout method:

if (EditorGUIUtility.hierarchyMode)
{
    int num = EditorStyles.foldout.padding.left - EditorStyles.label.padding.left;
    position.xMin -= (float)num;
}

The inspector is pretty much the only one who is setting the hierarchyMode to true. In most other cases if should be false.

So yes, then used in a custom inspector it will offset itself to the left to give space for the “triangle”. If rendered anywhere else (like in the example they rendered it in a custom EditorWindow) the triangle would be inside the given rect.

So the docs aren’t wrong, but missed to mention that polymorph behaviour ^^.