infor-design / enterprise-wc

Enterprise-grade web component library for the Infor Design System
Apache License 2.0
27 stars 26 forks source link

IdsListBuilder: Uncaught exception when adding an item when component is created via `document.createElement` and `document.insertAdjacentHTML` #2694

Open n-ace-ancog opened 1 month ago

n-ace-ancog commented 1 month ago

Describe the bug When the list builder is created via document.createElement or document.insertAdjacentHTML then added a new item, an uncaught exception is encountered.

NOTE creation via template works:

const html = `<ids-list-builder selectable="single" id="list-test"></ids-list-builder>`;
const template = document.createElement('template');
template.innerHTML = html;
document.querySelector('ids-container').appendChild(template.content.childNodes[0]);

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://main.wc.design.infor.com/ids-list-builder/example.html
  2. Open developer's console
  3. Enter the following code: (() => { const list = document.createElement('ids-list-builder'); document.querySelector('ids-container').appendChild(list); })();
  4. Add a new item on the newly created list builder
  5. See error
  6. Enter the following code: document.querySelector('ids-container').insertAdjacentHTML('beforeend', '<ids-list-builder></ids-list-builder>');
  7. Add a new item on the newly created list builder
  8. See error

Expected behavior A new item is created and no error encountered.

Version

Screenshots image

image

tmcconechy commented 1 month ago

Not as high priority as i thought. I think if you are going to create this like that you need to add the template.

        <ids-list-builder height="310px" selectable="single" id="list-builder-1">
          <template>
            <ids-text font-size="16" type="span">${manufacturerName}</ids-text>
          </template>
        </ids-list-builder>

We could make a default template or something...But not critical right now