gregnb / gregnb/mui-datatables

Cannot read property focus of null

Open
#1,168 2 comments 0 reactions 0 assignees View on GitHub
needs verification
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

Pressing the escape key causes an undefined error `this.searchButton.focus();` cannot read property focus of null.

## Expected Behavior
No error is thrown if the search button has a null reference, handle null checking.

## Current Behavior

An error is thrown.

## Steps to Reproduce (for bugs)

Type some text into a search bar, press escape, it throws an error for me. It could be due to the fact that we refetch data on changes in search text and that a ref is lost somewhere. I have no idea.

## Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI |3.9.3 |
| MUI-datatables | 2.14.0 |
| React | 16.8.6 |
| browser | latest chrome |

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue by typing in the search bar and pressing Escape, then trace the path involving `this.searchButton.focus()` and the search ref. Done means pressing Escape no longer throws when the search button reference is null; verify against Material-UI 3.9.3, MUI-Datatables 2.14.0, and React 16.8.6 if possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.