Filter changes the focus of TextInput after few words and does not allow to enter long words
Focus changes in middle of typing when filtering by text.
What you were expecting: Filter should allow user to input full text and should not change the focus of the textbox.
What happened instead: Everytime I type a text for filtering the focus of Text-box changes after entering some characters.
Steps to reproduce: Create a Filter with TextInput and use it in List
import { Filter, ReferenceInput, SelectInput, TextInput, List } from 'react-admin';
const PostFilter = (props) => (
<Filter {...props}>
<TextInput label="Search" source="q" resettable alwaysOn />
</Filter>
);
export const PostList = (props) => (
<List filters={<PostFilter />} {...props}>
// ...
</List>
);
In above code react-admin doesn't allow you to type a long text and changes focus of the text box after entering some characters.
Environment
- React-admin version: 2.8.2
What do you mean by "change the focus"? Does the input lose the focus?
@fzaninotto It does not allow user to input long text and focus from TextInput changes and you need to click on the box again to input more text.
Below is the GIF of same.

You can check the code in codeSandbox. If you want to check the behavior you can login to app using adminjss user and password as password.
@fzaninotto While debugging we noticed that dataprovider calls server two times for every filter search.
This issue has been resolved. This was an issue at a most fundamental level as described here - https://codepen.io/invisiblecomma/pen/wqLaZQ
We were redefining the functions which created our components, inside the render.
Closing this one since it's been resolved (I haven't tested) Feel free to re-open with a way to reproduce if needed.
I have the same issue , ListFilters Should be written out side of Main function that Solved my problem because rendering the Dataprovider calls which is out Focus my TextInput written in List Filters