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
focus() on a non-focusable legend delegates focus in WebKit/Chromium #3950
Comments
FYI, the tabbing order is also incompatible. Firefox treats a rendered |
@MatsPalmgren given the resolution of https://bugzilla.mozilla.org/show_bug.cgi?id=812687 I'm inclined to think that DOM order is "correct". |
Yeah, I agree. I filed a bug. |
Regarding the original issue, I think Edge/Firefox is "correct". I don't really see a reason for magically delegating focus like that. |
@mcking65 do you have an opinion here? |
100% agree that there is no reason to delegate focus; doing so is definitely a bug. |
@tkent-google you made a change in https://bugs.chromium.org/p/chromium/issues/detail?id=450511 , WDYT about removing this magic altogether? |
An important question is whether if any website relies on this WebKit/Chromium behavior or not. |
@tkent-google or @foolip would it be possible to add a use counter? |
Done: http://crrev.com/586606 |
Bug: 878220 Bug: whatwg/html#3950 Change-Id: Ia0d53411b9dbeb15555ed66bf7539d3fd3fdd509 Reviewed-on: https://chromium-review.googlesource.com/1192367 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#586606}
So apparently Firefox delegates focus when using an accesskey, but not for https://bugzilla.mozilla.org/show_bug.cgi?id=81481 Edge also behaves the same as Firefox, except if the legend is itself focusable (with |
The spec has this It doesn't check if the legend is itself focusable. It also says to skip descendants of the legend, but browsers don't do that AFAICT. |
Should §4.11.3.6 use the term rendered legend now instead of legend element?
Fwiw, I'd prefer to update the spec to follow what UAs do in this case. I think we should traverse the rendered legend and its descendants first, then other fieldset descendants when searching for an element that defines a command. If the rendered legend itself is focusable then it doesn't make sense to delegate the accesskey IMO. |
The behavior and semantic aspects typically use the DOM tree rather than how it's rendered. I think accesskey on legend should work the same even if you style it with e.g. float: left. |
Fixes #3950. Tests: web-platform-tests/wpt#12800 * Don't special-case focusable legend, like Edge/Chrome/Safari * Fix grammar * Fix wording * Use lists to make it less ambiguous * and * Address domenic's comments * Add an example * Source formatting nits
…ot delegate focus, a=testonly Automatic update from web-platform-tests HTML: test that focus() on legend does not delegate focus See whatwg/html#3950 -- wpt-commits: 910a8da21bb508cc774ae1acf9ead70f119ebb97 wpt-pr: 12801 --HG-- rename : testing/web-platform/tests/html/editing/focus/composed.window.js => testing/web-platform/tests/html/interaction/focus/composed.window.js rename : testing/web-platform/tests/html/editing/focus/document-level-focus-apis/document-level-apis.html => testing/web-platform/tests/html/interaction/focus/document-level-focus-apis/document-level-apis.html rename : testing/web-platform/tests/html/editing/focus/document-level-focus-apis/test.html => testing/web-platform/tests/html/interaction/focus/document-level-focus-apis/test.html rename : testing/web-platform/tests/html/editing/focus/focus-01.html => testing/web-platform/tests/html/interaction/focus/focus-01.html rename : testing/web-platform/tests/html/editing/focus/focus-02.html => testing/web-platform/tests/html/interaction/focus/focus-02.html rename : testing/web-platform/tests/html/editing/focus/focus-management/focus-event-targets-simple.html => testing/web-platform/tests/html/interaction/focus/focus-management/focus-event-targets-simple.html rename : testing/web-platform/tests/html/editing/focus/focus-management/focus-events.html => testing/web-platform/tests/html/interaction/focus/focus-management/focus-events.html rename : testing/web-platform/tests/html/editing/focus/processing-model/focus-fixup-rule-one-no-dialogs.html => testing/web-platform/tests/html/interaction/focus/processing-model/focus-fixup-rule-one-no-dialogs.html rename : testing/web-platform/tests/html/editing/focus/processing-model/preventScroll.html => testing/web-platform/tests/html/interaction/focus/processing-model/preventScroll.html rename : testing/web-platform/tests/html/editing/focus/processing-model/support/preventScroll-helper.html => testing/web-platform/tests/html/interaction/focus/processing-model/support/preventScroll-helper.html rename : testing/web-platform/tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html => testing/web-platform/tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-default-value.html rename : testing/web-platform/tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html => testing/web-platform/tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html rename : testing/web-platform/tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html => testing/web-platform/tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html rename : testing/web-platform/tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html => testing/web-platform/tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html rename : testing/web-platform/tests/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html => testing/web-platform/tests/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html rename : testing/web-platform/tests/html/editing/focus/tabindex-focus-flag.html => testing/web-platform/tests/html/interaction/focus/tabindex-focus-flag.html
…ot delegate focus, a=testonly Automatic update from web-platform-tests HTML: test that focus() on legend does not delegate focus See whatwg/html#3950 -- wpt-commits: 910a8da21bb508cc774ae1acf9ead70f119ebb97 wpt-pr: 12801
https://www.chromestatus.com/metrics/feature/timeline/popularity/2535 @tkent-google usage seems pretty low? |
Indeed. Chrome will remove this behavior. |
legend.focus() should not delegate focus. Bug: whatwg/html#3950 Bug: 880026 Change-Id: I35e046e45bbc45628f148383eaa77f12245e9e98 Reviewed-on: https://chromium-review.googlesource.com/c/1304180 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Amos Lim <eui-sang.lim@samsung.com> Cr-Commit-Position: refs/heads/master@{#603783}
Fixes whatwg#3950. Tests: web-platform-tests/wpt#12800 * Don't special-case focusable legend, like Edge/Chrome/Safari * Fix grammar * Fix wording * Use lists to make it less ambiguous * and * Address domenic's comments * Add an example * Source formatting nits
Fixes whatwg#3950. Tests: web-platform-tests/wpt#12800 * Don't special-case focusable legend, like Edge/Chrome/Safari * Fix grammar * Fix wording * Use lists to make it less ambiguous * and * Address domenic's comments * Add an example * Source formatting nits
Bug: 878220 Bug: whatwg/html#3950 Change-Id: Ia0d53411b9dbeb15555ed66bf7539d3fd3fdd509 Reviewed-on: https://chromium-review.googlesource.com/1192367 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#586606} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 37d150002f3144ae2181316a11d4c76b92beaab5
legend.focus() should not delegate focus. Bug: whatwg/html#3950 Bug: 880026 Change-Id: I35e046e45bbc45628f148383eaa77f12245e9e98 Reviewed-on: https://chromium-review.googlesource.com/c/1304180 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Amos Lim <eui-sang.lim@samsung.com> Cr-Original-Commit-Position: refs/heads/master@{#603783} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 2010bba41812ac1f3ea92a286c3894a14535766e
…ot delegate focus, a=testonly Automatic update from web-platform-tests HTML: test that focus() on legend does not delegate focus See whatwg/html#3950 -- wpt-commits: 910a8da21bb508cc774ae1acf9ead70f119ebb97 wpt-pr: 12801 UltraBlame original commit: de87d57a04c11fff1aee7f2805ce0600086f1692
…ot delegate focus, a=testonly Automatic update from web-platform-tests HTML: test that focus() on legend does not delegate focus See whatwg/html#3950 -- wpt-commits: 910a8da21bb508cc774ae1acf9ead70f119ebb97 wpt-pr: 12801 UltraBlame original commit: de87d57a04c11fff1aee7f2805ce0600086f1692
…ot delegate focus, a=testonly Automatic update from web-platform-tests HTML: test that focus() on legend does not delegate focus See whatwg/html#3950 -- wpt-commits: 910a8da21bb508cc774ae1acf9ead70f119ebb97 wpt-pr: 12801 UltraBlame original commit: de87d57a04c11fff1aee7f2805ce0600086f1692
legend.focus() should not delegate focus https://bugs.webkit.org/show_bug.cgi?id=189242 Reviewed by Ryosuke Niwa. This patch is to align Webkit with Blink / Chromium, Gecko / Firefox and Web-Specification. Web-Spec Discussion Issue - whatwg/html#3950 Merge - https://chromium.googlesource.com/chromium/src.git/+/2010bba41812ac1f3ea92a286c3894a14535766e This patch removes focus delegation and accesskey from the legend element to align with Web-Specification. * Source/WebCore/html/HTMLLegendElement.h: (1) Remove "HTMLFormControlElement" class (2) Remove "associatedControl", "accessKeyActions" and "focus" function * Source/WebCore/html/HTMLLegendElement.cpp: (HTMLLegendElement::associatedControl): Deleted (HTMLLegendElement::focus): Ditto (HTMLLegendElement::accessKeyAction): Ditto * LayoutTests/fast/form/legend-access-key.html: Deleted * LayoutTests/fast/form/legend-access-key-expected.txt: Deleted * LayoutTests/fast/form/focus.html: Updated * LayoutTests/fast/form/focus-expected.txt: Ditto * LayoutTests/fast/forms/focus-selection-textarea-expected.txt: Ditto * LayoutTests/fast/forms/focus-selection-input.html: Ditto * LayoutTests/fast/forms/focus-selection-input-expected.txt: Ditto * LayoutTests/fast/form/access-key-expected.txt: Ditto * LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/legend-expected.html: Rebaselined * LayoutTests/platform/ios/TestExpectations: Remove 'deleted' testcase expectation * LayoutTests/platform/win/TestExpectations: Remove 'deleted' testcase expectation Canonical link: https://commits.webkit.org/258074@main
See https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/fast/forms/fieldset/legend-focus.html?q=lang:html+fieldset&sq=package:chromium&dr=C
Demo http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6129
In WebKit and Chromium, the first input in the fieldset is focused. In EdgeHTML and Gecko, focus is not delegated.
cc @whatwg/fieldset
The text was updated successfully, but these errors were encountered: