Question: failed to read attribute 'tabIndex' when setAttribute in useEffect
- Dominant language
- JavaScript
- Stars
- 19.8k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
```js
const inputRef = useRef(null);
useEffect(() => {
if (tabIndex){ // if tabIndex provided
inputRef.current.setAttribute('tabindex', tabIndex);
}
}, []);
return
```
test
```js
const wrapper = mount();
console.log(wrapper.update().find('input').props())
expect(wrapper.update().find('input').props()['tabindex']).toEqual(10); // undefined
// => {
// disabled: false
// }
// no tabIndex nor tabindex
```
Both of
```wrapper.update().find('input').props()['tabindex']```
and
```wrapper.update().find('input').props()['tabIndex']``` are ```undefined```
Anything wrong here?
#### API
- [ ] shallow
- [x] mount
- [ ] render
#### Version
| library | version
| ------------------- | -------
| enzyme | 3.10.0
| react | 16.8.6
| react-dom | 16.8.6
| react-test-renderer |
| adapter (below) | 1.14.0
Contributor guide
Assessment
This issue has not been assessed yet.