Comments (5)
I agree, date picker should close onBlur or onFocusOut of the component.
from react-datetime.
It's not possible to close it on blur because when the user clicks on the calendar, the input loses the focus and it would get closed.
You could try it yourselves with something like:
<DateTime ref="picker" inputProps={{ onBlur: () => this.refs.picker.closeCalendar() }} />
from react-datetime.
This actually covers my use case well. Im mainly concerned when there are multiple DateTime widgets on the screen in a single form and you quickly tab through the form and they all remain open.
I just implemented the above and it works well - however, the next/previous buttons are marked us as button
elements so when tabbing the focus goes to these rather than the next field. Is there any particular reason these are buttons given that the rest of the widget doesn't seem to be keyboard accessible? These could be changed to spans.
from react-datetime.
For me the example did not work, I could not select any date anymore. This hack works for me
inputProps={{
onBlur: () => {
setTimeout(
() => this.refs.picker.closeCalendar(),
100
)
}
}}
from react-datetime.
@mleonard87 I think the <button>
elements are replaced with <span>
elements. I've tried having multiple components on a single page and I can successfully tab between them without anything else but the <input>
element getting focus.
Thanks for the solution and comments. I will close this now, if anyone is still having issues just re-open this again.
from react-datetime.
Related Issues (20)
- Cursor moves to the end when editing the date/time value.
- Date time picker is working fine in local but not in cloud server once code has been moved HOT 2
- not work as a control component
- Minified React error #130 HOT 1
- Select wrong date 31/08 v3.1.1 HOT 10
- Add name attribute to react date time HOT 1
- Custom arrows
- Year range displayed in the header.
- Console spammed with Invalid date passed to the `setViewDate`
- Issue while selecting previous month date from FEBRUARY. HOT 12
- onBeforeNavigate, onNavigateForward these two props should have access to value as shown in docs
- Keyboard input for time
- webpack error HOT 1
- umd not working in browser
- disabled not working when using input props
- What is the latest version?
- When date is changed before daylight savings, time does not update to be standard time
- Date Lable duplicates in Every Year of April(Day-Light Saving) when Timezone is "Africa/Cairo"
- Soluiton
- Enable the option to edit the time in the Timepicker. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-datetime.