link attributes widget generates the same id for all select elements
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #2931618. --> Reported by: [Bcwald](https://www.drupal.org/user/215794) >>> <p>Hi, I am working on an <a href="https://www.drupal.org/project/material_admin">admin theme</a> and an issue came up in the queue with someone working with link_attributes. <a href="https://www.drupal.org/project/material_admin/issues/2931557">https://www.drupal.org/project/material_admin/issues/2931557</a></p> <p>Essentially, if you have a link field that can have multiple instances, the<br> <select> element for "target" always generates the exact same ID (target) on each new element, which causes invalid markup because of multiple instances of the same ID.</select></p> <p>I rely on the ID so that I can move the select element before the label when necessary. I am working on a solution for better handling unknown markup but I figured I would create an issue for this project while I am at it, since this still is a bug in the module.</p> <p>Reproduce steps:</p> <p>- Create a link field on a node -&gt; set the 'allowed number of values' to 'unlimited'.<br> - Set the form display widget to use link attributes<br> - create multiple values of that field. Inspect the elements.<br> - see all<br> <select> elements have the same ID of "target".</select></p> > Related issue: [Issue #2931557](https://www.drupal.org/node/2931557)
issue