实现:无法在 Dropdown._makeDropdownFocusable 处将属性“tabIndex"设置为 null [英] Materialize: Cannot set property 'tabIndex' of null at Dropdown._makeDropdownFocusable

查看:15
本文介绍了实现:无法在 Dropdown._makeDropdownFocusable 处将属性“tabIndex"设置为 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过包含 materialize select 的 jest 测试我的 vuejs 组件.在执行组件测试时,我在 materialize.js 中收到以下错误:

TypeError: 无法在 Dropdown._makeDropdownFocusable 处设置属性 'tabIndex' 为 null

如何修复此错误?

解决方案

当输入字段未包含在具有类输入字段的 div 中时,可能会发生此问题:

 

<input type="text" class="autocomplete"></input>

添加一个带有input-field"类的div可能会解决这个问题.

I am trying to test my vuejs component via jest that contains materialize select. When performing a component test, I get the following error in materialize.js:

TypeError: Cannot set property 'tabIndex' of null at Dropdown._makeDropdownFocusable

How fix this error?

解决方案

This problem can happen when the input field is not wrapped inside a div with the class input-field:

  <div class="input-field">
    <input type="text" class="autocomplete"></input>
  </div>

Adding a div with the class "input-field might solve this problem.

这篇关于实现:无法在 Dropdown._makeDropdownFocusable 处将属性“tabIndex"设置为 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆