Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 110ae1a60592b7cdf1460fdce01c54aae21a8794
      
https://github.com/WebKit/WebKit/commit/110ae1a60592b7cdf1460fdce01c54aae21a8794
  Author: Tyler Wilcock <[email protected]>
  Date:   2025-10-13 (Mon, 13 Oct 2025)

  Changed paths:
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/no-blur-when-opening-picker-expected.txt
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/no-blur-when-opening-picker.html
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/picker-keyboard-accessibility-expected.txt
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/picker-keyboard-accessibility.html
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/space-does-not-scroll-page-expected.txt
    A 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/space-does-not-scroll-page.html
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/FocusEvent.cpp
    M Source/WebCore/dom/FocusEvent.h
    M Source/WebCore/html/BaseDateAndTimeInputType.cpp
    M Source/WebCore/html/BaseDateAndTimeInputType.h
    M Source/WebCore/html/shadow/DateTimeEditElement.cpp
    M Source/WebCore/html/shadow/DateTimeEditElement.h
    M Source/WebCore/html/shadow/DateTimeFieldElement.cpp
    M Source/WebCore/html/shadow/DateTimeFieldElement.h
    M Source/WebCore/page/FocusController.cpp
    M Source/WebCore/platform/DateTimeChooserParameters.h
    M Source/WebKit/Platform/spi/mac/AppKitSPI.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h
    M Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm

  Log Message:
  -----------
  AX: It's impossible to select a date in the date picker from <input 
type="date"> using the keyboard
rdar://161759633
https://bugs.webkit.org/show_bug.cgi?id=299979

Reviewed by Aditya Keerthi.

Prior to this commit, the NSDatePicker created by date inputs was entirely 
inaccessible to keyboard and assistive
technology users. The primary reason for this is that the NSDatePicker was not 
given first respondership, and thus
didn't receive any key events. This commit implements mechanisms that allowing 
managing keyboard focus state between
the date picker, and the backing date input. The interactity model for date 
inputs and their associated pickers are
as follows:

  - Pressing Space while focused on a date subfield (e.g. day, month, year 
field) moves focus into the picker.

  - Pressing Escape while focus is in the picker moves focus back to the 
previously focused subfield.

  - Clicking on a subfield with the mouse leaves focus on that subfield so you 
can increment / decrement using the
    arrow keys (matching shipping behavior and platform date pickers).

All of the above behavior is captured in a new layout test: 
picker-keyboard-accessibility.html

It's also important that the movement of keyboard focus into the picker does 
not cause any new web-exposed events to
be fired (e.g. blur). Shipping Safari, nor any other browser fire any blur or 
focus change events when opening the picker.
FocusController::dispatchEventsOnWindowAndFocusedElement is updated with this 
commit to avoid that, and new
test no-blur-when-opening-picker.html verifies we behave correctly on this 
front.

Finally, this commit also fixes an existing bug where pressing the space key to 
open the date picker scrolls the page
resulting in the picker appearing and immediately disappearing as a result of 
the scroll. New test space-does-not-scroll-page.html
verifies we behave correctly.

Tests: 
fast/forms/datetimelocal/datetimelocal-editable-components/no-blur-when-opening-picker.html
       
fast/forms/datetimelocal/datetimelocal-editable-components/picker-keyboard-accessibility.html
       
fast/forms/datetimelocal/datetimelocal-editable-components/space-does-not-scroll-page.html

* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/no-blur-when-opening-picker-expected.txt:
 Added.
* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/no-blur-when-opening-picker.html:
 Added.
* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/picker-keyboard-accessibility-expected.txt:
 Added.
* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/picker-keyboard-accessibility.html:
 Added.
* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/space-does-not-scroll-page-expected.txt:
 Added.
* 
LayoutTests/fast/forms/datetimelocal/datetimelocal-editable-components/space-does-not-scroll-page.html:
 Added.
* Source/WebCore/dom/Element.h:
(WebCore::Element::transferredFocusToPicker const):
(WebCore::Element::didSuppressBlurDueToPickerFocusTransfer):
* Source/WebCore/dom/FocusEvent.cpp:
(WebCore::FocusEvent::debugDescription const):
* Source/WebCore/dom/FocusEvent.h:
* Source/WebCore/html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent):
(WebCore::BaseDateAndTimeInputType::didReceiveSpaceKeyFromControl):
(WebCore::BaseDateAndTimeInputType::setupDateTimeChooserParameters):
(WebCore::BaseDateAndTimeInputType::closeDateTimeChooser):
* Source/WebCore/html/BaseDateAndTimeInputType.h:
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::dispatchSimulatedClickIfActive):
(WebCore::InputType::dispatchSimulatedClickIfActive const): Deleted.
* Source/WebCore/html/InputType.h:
* Source/WebCore/html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditElement::defaultEventHandler):
(WebCore::DateTimeEditElement::didFieldOwnerTransferFocusToPicker):
(WebCore::DateTimeEditElement::didSuppressBlurDueToPickerFocusTransfer):
* Source/WebCore/html/shadow/DateTimeEditElement.h:
* Source/WebCore/html/shadow/DateTimeFieldElement.cpp:
(WebCore::DateTimeFieldElement::transferredFocusToPicker const):
(WebCore::DateTimeFieldElement::didSuppressBlurDueToPickerFocusTransfer):
* Source/WebCore/html/shadow/DateTimeFieldElement.h:
* Source/WebCore/page/FocusController.cpp:
(WebCore::dispatchEventsOnWindowAndFocusedElement):
* Source/WebCore/platform/DateTimeChooserParameters.h:
* Source/WebKit/Platform/spi/mac/AppKitSPI.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm:
(-[WKDateTimePicker initWithParams:inView:]):
(-[WKDateTimePicker showPicker:]):
(-[WKDateTimePicker updatePicker:]):
(-[WKDateTimePicker invalidate]):
(-[WKDateTimePicker handleEscapeKey]):
(-[WKDateTimePicker didChooseDate:]):
(-[WKDateTimePicker wasActivatedByKeyboard]):
(-[WKEscapeHandlingDatePicker setDateTimePicker:]):
(-[WKEscapeHandlingDatePicker dateTimePicker]):
(-[WKEscapeHandlingDatePicker keyDown:]):
(-[WKEscapeHandlingDatePicker acceptsFirstResponder]):

Canonical link: https://commits.webkit.org/301432@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to