Problem

The module is working but in the console is the following error message:

drupal.js?v=8.9.6:13 Uncaught TypeError: Cannot set property 'tabIndex' of null
    at Dropdown._makeDropdownFocusable (materialize.js:2527)
    at new Dropdown (materialize.js:2278)
    at Function.init (materialize.js:1045)
    at Function.init (materialize.js:2782)
    at Autocomplete._setupDropdown (materialize.js:6484)
    at new Autocomplete (materialize.js:6411)
    at Function.init (materialize.js:1049)
    at Function.init (materialize.js:6755)
    at S.fn.init.jQuery.fn.<computed> [as autocomplete] (materialize.js:1138)
    at Object.attach (autocomplete.js?v=8.9.6:121)

Steps to Reproduce

  1. Go to manage fields for a content type.
  2. Add a field of type Time Picker.
  3. Go the the add content form for that content type.
  4. Open the browser console.
  5. You should see the error.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wombatbuddy created an issue. See original summary.

carlosrfm’s picture

Version: 8.x-5.x-dev » 8.x-5.3
carlosrfm’s picture

Version: 8.x-5.3 » 8.x-5.x-dev
carlosrfm’s picture

Version: 8.x-5.x-dev » 8.x-5.3
carlosrfm’s picture

Version: 8.x-5.3 » 8.x-5.x-dev
carlosrfm’s picture

Status: Active » Needs review
StatusFileSize
new490 bytes

After few tests, I figured this out. It has to do with the scripts loading order, assigning a negative weight to the materialize script, the issue goes away.

In our case, the error was breaking the functionality of an autocomplete field that was located after the time range picker field.

jidrone’s picture

Issue summary: View changes

Updated description to include steps to reproduce.

jidrone’s picture

Issue summary: View changes
teodorakis’s picture

Faced exactly same issue as carlosrfm described. Patch in #6 fixed it.

teodorakis’s picture

Status: Needs review » Reviewed & tested by the community
yaroslav drapoy’s picture

Doesn't fix it on drupal core 9.4.8 and 9.5.3 (tested also on pure drupal 9.5.3 installation). Could you please share what the external lib depends on to figure out why the weight fixes the issue on your side? The same issue with autocomplete field that is located after time range picker field. I tried another weights and it still doesn't work.

yaroslav drapoy’s picture

Found that in drupal core 9.5.3 autocomplete-min.js has weight -11.7. So for materialize.js I set weight -12 and it works now (on drupal core 9.5.3)
UPD: Also it works on core 8.9.20 pure installation.

kunal_sahu made their first commit to this issue’s fork.

kunal_sahu’s picture

Hi I have created a MR . Please merge thanks

jidrone’s picture

Hi @kunal_sahu

I don't see any difference between the MR you created and the patch.

jellyburger’s picture

Lovely module. Are there any plans to release a version for Drupal 10? Thank you.

bobi-mel’s picture

Hi @kunal_sahu
I checked your changes. The bug was fixed.