My problem was, that jQuery object was not attached to the DOM yet, so inner materialise code could not init element due to inability to find element by ID:
// materializecss initing dropdown (in my case for input autocomplete), where `t` is the input element
i.id = M.getIdFromTrigger(t),
i.dropdownEl = document.getElementById(i.id),
i.$dropdownEl = h(i.dropdownEl),
M.getIdFromTrigger(t)
returned some random ID (not the one I provided) and dropdownEl
was inited with null, and later method _makeDropdownFocusable
failed on using it `this.dropdownEl.tabIndex = 0
So my problem code looked like this:
let root = $('#root');
let wrapper = $('<div>');
let input = $('<input>').appendTo(wrapper);
initAutocomplete(input)
root.append(wrapper)
So the quick fix is to append elements first and only than do M.Autocomplete.init
*.tabIndex
is used? – Sajib Khanmaterial-select
, who containts this template:<select><slot></slot></select>
– Vitaliy Demchuk