Do not override an existing id attribute

Also replace a "Yoda conditional" and add a code comment.

Closes #3404669

Merge request reports

Loading