Skip to content
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

Order of actions for labeled control should be focus then click #3702

Closed
wants to merge 1 commit into from
Closed

Order of actions for labeled control should be focus then click #3702

wants to merge 1 commit into from

Conversation

Ahmad-S792
Copy link
Contributor

@Ahmad-S792 Ahmad-S792 commented Aug 26, 2022

Order of actions for labeled control should be focus then click

https://bugs.webkit.org/show_bug.cgi?id=119372

Merge - https://chromium.googlesource.com/chromium/blink/+/237028d603d5fe587ec282f6d2cf3b5a31c01902

Order of actions for labeled control should be focus then click.

When we click on a checkbox or a radio button, event order is:
 - mousedown
 - focus, triggered by mousedown
 - mouseup
 - change, triggered by the following click
 - click

That is to say, we focus on it first and then click it. Click on an
associated label should have same behavior.

It is align with behavior of Blink / Chromium and Gecko (Firefox).

* Source/WebCore/html/HTMLLabelElement.cpp:
(HTMLLabelElement::defaultEventHandler) - Move dispatchSimulatedClick after "updateLayourIgnorePendingStyleSheet".
* LayoutTests/fast/forms/label/label-event-order.html: Added new test
* LayoutTests/fast/forms/label/label-event-order-expected.txt: Added test expectations

bb2ac69

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe ❌ πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl ❌ πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug ❌ πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac ❌ πŸ§ͺ api-gtk
βœ… πŸ›  tv ❌ πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim ❌ πŸ§ͺ mac-wk2
βœ… πŸ›  watch ❌ πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 26, 2022
Order of actions for labeled control should be focus then click

https://bugs.webkit.org/show_bug.cgi?id=119372

Merge - https://chromium.googlesource.com/chromium/blink/+/237028d603d5fe587ec282f6d2cf3b5a31c01902

Order of actions for labeled control should be focus then click.

When we click on a checkbox or a radio button, event order is:
 - mousedown
 - focus, triggered by mousedown
 - mouseup
 - change, triggered by the following click
 - click

That is to say, we focus on it first and then click it. Click on an
associated label should have same behavior.

It is align with behavior of Blink / Chromium and Gecko (Firefox).

* Source/WebCore/html/HTMLLabelElement.cpp:
(HTMLLabelElement::defaultEventHandler) - Move dispatchSimulatedClick after "updateLayourIgnorePendingStyleSheet".
* LayoutTests/fast/forms/label/label-event-order.html: Added new test
* LayoutTests/fast/forms/label/label-event-order-expectation.txt: Added test expectations
@rniwa
Copy link
Member

rniwa commented Aug 28, 2022

Looks like the newly added test is failing?

@Ahmad-S792
Copy link
Contributor Author

Looks like the newly added test is failing?

It is failing newly added test and also one which is already available (label-becomes-visible-while-clicking-on-label.html), when I changed already available test into JSFiddle - https://jsfiddle.net/r3mjfzey/ - Safari behaves differently compared to other browsers (e.g. Clicking on "Click Me", will make field active and caret will show to start typing and it does in Safari. While in other browsers, Chrome Canary 107 and Firefox Nightly 106, it does just focus but not have caret in it to start typing). I am not sure, which browser is working correctly. Similar, newly added test (https://jsfiddle.net/1jzfho0n/), fails on first sub-test in Safari while other browsers make it pass. I checked and test (label-becomes-visible-while-clicking-on-label.html) is Webkit specific and it is not in Chromium GitHub.

@Ahmad-S792
Copy link
Contributor Author

@rniwa - this commit added - https://commits.webkit.org/136596@main (Currently failing test).

@Ahmad-S792
Copy link
Contributor Author

Unfortunately, I am getting weird error on my GitHub fork and I have delete it and add again. I am closing this PR right now and will look into once I fix my Git errors. Thanks!

@Ahmad-S792 Ahmad-S792 closed this Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merging-blocked Applied to prevent a change from being merged
Projects
None yet
4 participants