Datepicker


 

 

type: widget

release: 0.0

status: in development

demo/documentation: http://view.jqueryui.com/datepicker/demos/datepicker/

 


 

1 - Description:

 

This is a brand new planning page to discuss the code refactor of the current datepicker plugin:

http://jqueryui.com/demos/datepicker/

 

To have a fresh start on the planning on this refactor, the older wiki page that covered current and future datepicker and calendar ideas is archived here: DatePickerCalendar

 

The specific code and functionality changes we want to address in this refactor are:

 

Sampling of feature requests that we might want to consider adding or accommodating as an extension to core picker:

 

Existing Refactors

 

 

2 - Visual Design:

 

 

 


 

 

3 - Functional Specifications/Requirements:

 

Options:

 

Methods:

 

Events:

 

Globalization:

 

 


 

4 - Markup & Style:

 

4.1 Initial markup examples

 

<input>

 

<input min="1970-01-01" max="2020-12-31" value="2009-05-22">

4.2 Recommended transformed HTML markup

 

(The HTML markup structure and classes that will be used by the scripts in the enhanced version) 

 

4.3 Accessibility recommendation

 

(Detailed recommendations for ARIA, HTML markup, CSS and javascript that will contribute to universal access and full section 508 accessibility for screen readers, mobile devices and any other devices) 

 

Issues with current datepicker:

 

See example:

http://oaa-accessibility.org/example/15/ 

 

Reason for separating templates: Refreshing the entire datepicker during interaction confuses screen readers, specifically because the date picker title is marked up as a live region and will often not be announced if it's destroyed and recreated (as opposed to having its text contents change). Additionally, with a single template approach, clicking the "prev" and "next" links would lead to the entire template to being refreshed. The would cause a loss of focus because the focused link itself would be removed as well. Separating the templates gets rid of these accessibility issues, and also allows developers to modify parts of the datepicker without having to duplicate the entire template.

 

Proposed Keyboard Support (Default Date Picker)

Feature
Keyboard
 
Open Date Picker
  • Tab into date textbox automatically opens and moves focus to Date Picker Dialog box
  • Focus should be on the current date gridcell in the calendar grid after the dialog box opens; or If a date had already been entered in the textbox focus should be in the date gridcell identified in the texbox
 
Close Date Picker and no change to textbox
  • ESCape closes Date Picker Dialog box and moves focus to text box with no change to the date in the textbox
  • Enter key on the Close Button closes Date Picker Dialog box and moves focus to text box with no change to the date in the textbox
 
Close Date Picker and update date in textbox
  • Enter key when focus is on a date gridcell in the calendard grid closes Date Picker Dialog box and moves focus to text box with the last selected date from the calendar grid populating the textbox
 
Navigate dates (Calendar Grid)
  • up, down, left and right keys move focus and selected date between gridcells in the calendar grid
 
Tab Navigation
  • Keyboard focus stays in date picker dialog box until dialog box closes
  • Tab moves between:
    • Close button
    • Month navigation buttons (next month, previous month)
    • Calendar grid
 

Other Features

Feature
Description
entering date in textbox
  • Allow other formats (e.g. Jan, mm-dd-yyy...) and auto correct
  • If only one format provide help information on the date format allowed (MM/DD/YYYY)
  • Use aria-describedby to reference the formatting information
close button???
  • Should date picker have a close button???
Labeling date cells
  • Use aria-label or aria-labelledby on each gridcell  to create an accessible name for each grid cell options:
    • "Day-of-week the day" (e.g Saturday the 10th)
    • "Day Day-of Week" (e.g. 10th Saturday)
  • aria-describedby to date and year information
Changes in month/Year
  • Live region to announce changes in month and year

 

Keyboard Testing:

W3C

Keyboard navigation on days that are not included the currently displayed month should move to the month automatically and lead to the day in the next or previous month.

 

Color Contrast

 

ARIA Support

 

4.4 CSS & Theme

 

(Description of the CSS classes to be used for all states, how custom theming and Themeroller support will work.) 

 


 

5 - Latest version of plugin:

 

http://view.jqueryui.com/datepicker/demos/datepicker/default.html


 

6 - Open issues being discussed  

 

 

Options and methods which needs discussion

 

 

Here's all the current options and methods.

 

Options:

 

Methods:

 

 

Next Steps / ToDo (Felix)

 

 


Proposed functionality of the value method / option

 

value method:


value option / valueAsDate method:

 


Split Datepicker Widget in Datepicker and Calendar Widget

 

Calendar Widget

 

Datepicker Widget

 

See PR: https://github.com/jquery/jquery-ui/pull/1260

 

external/date.js

 

Currently, `date.js` is located under `/external`. But, it is NOT an external library. It's NOT hosted (neither version-controlled) anywhere except in here. Aside from confusing, this makes AMD or CommonJS setup hard/awkward. So, we need to either make it an external library or move it into `./ui` (where all our sources files live).

Globalize related

 

Currently, `external/localization.js` holds CLDR data. We need to figure out how to deal with this data in demos and tests.

 

The translation data ("done", "prev", "next"; button names basically) is configured via the labels option.

 

Week numbers are currently implemented. Should they be removed and just shown in a demo with an extension?

 

Change eachDay to provide an actual element and simplify the custom API. Idea (not full implementation): https://gist.github.com/scottgonzalez/fadc55ffadff5241ffb1

 

When parsing min and max attributes, require them to follow the HTML spec. Same should be applied to spinner (though that is a breaking change)

 

Do we want to support an array for numberOfMonths?

 

Do we need a refresh() method? When would it be used?

 

What is the use case for the beforeOpen event?

 

Need to add a culture/locale option to match spinner or decide to remove it from spinner. -> Option has been added to datepicker. 

Does this handle non-Gregorian calendars?

 

Handle year before month in header based on locale.

 

Compared to master, the default date format is different, is that intended? Master has 4 digit years, rewrite only 2