I suspect some reparenting takes place at runtime. Try anchoring with id instead of parent.
QML TextField: Cannot anchor to an item that isn't a parent or sibling.