Implement live-update and double-escape for date and week input popups
This change implements live-update and double-escape behavior for date and week control popups. When arrow keys are used to change the selection, the changes are immediately reflected on the in-page control (and input events are fired). When the user hits escape, if they have made changes these are reverted without closing the popup. A second escape (or the first one, if no changes were made) closes the popup. Behavior when clicking on a date is not changed; the popup is still submitted immediately (as opposed to other types like datetime-local where the user may want to go on to select other values after clicking the date). Initialization of these controls is changed such that if there is any valid date, one will be selected. This will be the nearest possible date to the value attribute if there is one, otherwise it will be the nearest possible to today's date. This avoids scenarios where we don't paint a focus ring because there is no starting selected date. I've moved the popup submission and cancellation behavior to the top-level key event handler to better match the style of the other refreshed controls. One of my new tests uncovered a potential performance issue where selectNearestValidRangeLookingForward(Backward) could spin for a long time if the min/max attributes were very far from Today. These functions now immediately clamp to within the min/max range to avoid this. Lastly, I'm suppressing a CSS background color animation that the refreshed calendar pickers were erroneously inheriting from the old calendar implementation. A corresponding update will follow to bring live-update and double-escape to the month control. Bug: 1045195 Change-Id: I487bc2cbaefc3056d4ee50898bb6d96f0c9c6182 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024158Reviewed-by:Mason Freed <masonfreed@chromium.org> Reviewed-by:
Ionel Popescu <iopopesc@microsoft.com> Commit-Queue: Dan Clark <daniec@microsoft.com> Cr-Commit-Position: refs/heads/master@{#736532}
Showing






File moved