We have installed react-datepicker component. The default behaviour is that the calendar is getting opened on tab keypress from previous field. How can I avoid this. Please suggest as I am unable to override the default behaviour of this component. I just want the focus to be on this control when tab is pressed.
Asked
Active
Viewed 2,475 times
2 Answers
3
You can use preventOpenOnFocus property
<DatePicker
...
preventOpenOnFocus={true}
/>

Angel Alvarez Pérez
- 368
- 2
- 7
0
You can open it manually:
<DatePicker
ref={(c) => this._calendar = c}
locale='ru'
...
customInput={<InputField {...this.props} calendar={this._calendar}/>}
/>
And then somewhere
this._calendar.setOpen(bool)

Meghshyam Sonar
- 394
- 3
- 12
-
Can you please provide a fiddler example? – pratham gn Oct 23 '20 at 11:10