-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove jQuery calendar from DateField #6626
Comments
👍 from me. Using html5 date input is preferable in this day and age, especially where mobile browsers might break legacy JS libraries. |
I'd like to suggest some adjustmens @chillu . I might argue to simply force datefield to html5, and rely on front-end technology to provide the polyfill. The reason I don't suggest this for numericfield is that numericfield does not localise numbers in html5 mode, whereas datefield does (in most browsers). non-html5 behaviour requires a huge amount of code to ensure it works properly, and it would be prudent to trim this down to the minimum. It also complicates the "nonhtml5 / html5" forms that react needs to support when porting this functionality to formschema. This story should be addressed prior to #6140 as a blocker. |
I've thought about this a bit more, and think we can create an acceptable user experience without pulling in a whole bunch of code for a date picker UI - I'm hoping to get rid of jQuery UI in the lifespan of 4.x. Additional research:
Suggested additional tasks:
|
👍 I'm comfortable that we take this approach for beta1 and then user test the result. It'll mean that a lot of users (IE11, Firefox, Safari) won't get a date picker, but we don't need to pre-judge the impact of this — that's what user testing is for. |
Client-side validation isn't (easily) supported in the Entwine-based CMS, so it's overkill to invest into this - let's only do client-side validation in the new React-based stuff. HTML5 browser validation also doesn't kick in because we prevent the native form submission via a |
Test setup:
Confirmed HTML5 operation:
Confirmed non-HTML5 operation:
|
No longer needed, see silverstripe/silverstripe-framework#6626 Reinstated customisation from silverstripe/silverstripe-framework@abaebbe
No longer needed, see silverstripe/silverstripe-framework#6626 Reinstated customisation from silverstripe/silverstripe-framework@abaebbe
OK, everything is merged. |
Followup from #6194, where @tractorcow has refactored
DateField->setConfig('showcalendar', true)
toDateField->setShowCalendar(true)
. This triggered a discussion whether the PHP API should care about these view aspects, in particular around the "sub views" implemented in DateField to support the CMS use case (DateField_View_JQuery
). Since the introduction of this functionality, we've gained a HTML5 date type which comes with built-in, localised date pickers in modern browsers like Chrome, IE Edge and Safari (supported browser overview). Given we want to remove jQuery UI from core in favour of React components, this was a good point to revisit the client-side library use as well.Merge Process
Tasks
DateField_View_JQuery
and jQuery datepicker related logicDateField.js
wrapper for jQuery UIDateField->setShowCalendar()
DateField->setHTML5()
(consistent withNumericField->setHTML5()
)DateField->setLocale()
andsetFormat()
(will be overruled by browser on presentation onsetHTML5(true)
). Throw exception if locale or format isn'tnull
or ISO onsetHTML5(true)
setHTML5(true)
Point to type=date polyfill if CMS users are stuck on older browsers (https://github.com/jonstipe/date-polyfill)(building a MomentJS polyfill instead)Replicate logic to(nice to have)DatetimeField
(with type=datetime-local)TimeField
(with type=time)Validate user input through Moment.jsDidn't have client-side validation beforehand (with or without datepicker), let's stick to server-side for the polyfillResources:
The text was updated successfully, but these errors were encountered: