NEW 225915
<input type="date"> should trigger selectionchange event as selection moves between parts
https://bugs.webkit.org/show_bug.cgi?id=225915
Summary <input type="date"> should trigger selectionchange event as selection moves b...
Andy E
Reported 2021-05-18 07:29:35 PDT
I'm filing this bug in the interests of parity with other browsers, namely Firefox, Chrome, Edge and Opera. In those browsers, as you press the arrow keys or tab keys in a date input, a selectionchange event triggers *if* the selection moved to another part of the date. For instance, if the format were dd/MM/yyyy and the selection was on dd, pressing ArrowRight will move to mm and trigger a selectionchange. If the input was on yyyy and the user presses ArrowRight, the selection does not change and no selectionchange event is triggers. Currently, Safari does not fire the selectionchange event at any point whilst moving between parts. Although there's no useful information to be gained from the selection object itself (indeed, both Blink and Gecko don't provide anything when `window.getSelection()` is called), the event is useful for knowing when *nothing* happened. For our particular usecase, we have a spreadsheet-like component, you can enter a cell that has a date format and the date input appears. We want the ArrowLeft/ArrowRight keys to move to adjacent cells when on the leftmost/rightmost parts, much like Excel does but without hindering the user's ability to interact with the date input. The easiest way to do this is to move out if the key event was not immediately followed by a selectionchange event. Without the selectionchange event it likely requires hacks or is not possible in Safari at all.
Attachments
Radar WebKit Bug Importer
Comment 1 2021-05-25 07:30:17 PDT
Note You need to log in before you can comment on or make changes to this bug.