Make KeyboardFocusableScrollers keyboard-focus but not mouse-focus [chromium/src : main]

0 views
Skip to first unread message

Mason Freed (Gerrit)

unread,
Aug 26, 2024, 6:13:50 PM8/26/24
to Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
Attention needed from Aaron Leventhal

Mason Freed voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Aaron Leventhal
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
Gerrit-Change-Number: 5812197
Gerrit-PatchSet: 4
Gerrit-Owner: Mason Freed <mas...@chromium.org>
Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
Gerrit-Comment-Date: Mon, 26 Aug 2024 22:13:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Aaron Leventhal (Gerrit)

unread,
Aug 26, 2024, 6:29:54 PM8/26/24
to Mason Freed, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
Attention needed from Mason Freed

Aaron Leventhal added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Aaron Leventhal . unresolved

I'm only an owner of the a11y code. The changes to ax_object.cc look good. However, I wanted to make sure that our list of things to check (from chat) are good to go:
1. We disconnect keyboard focusability from click focusability, right? (That's the main point of this CL I believe)
2. Make scrollers just keyboard focusable. In both cases, IsFocusable() will be true.
3. Make sure the area is still scrollable with the keyboard after a click, as it used to be, even if it is not focused
4. Make sure AXObject::OnNativeClickAction() still sets the focus for scrollable areas. That's the function that's called when a screen reader user asks to activate something.
5. Determine what to do for scrollableArea.focus() -- I assume this should take focus even if it is not click-focusable

Do we need to any any tests for these?

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 4
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Mon, 26 Aug 2024 22:29:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 27, 2024, 11:57:17 AM8/27/24
    to David Baron, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Aaron Leventhal and David Baron

    Mason Freed voted and added 2 comments

    Votes added by Mason Freed

    Auto-Submit+0

    2 comments

    Patchset-level comments
    Aaron Leventhal . unresolved

    I'm only an owner of the a11y code. The changes to ax_object.cc look good. However, I wanted to make sure that our list of things to check (from chat) are good to go:
    1. We disconnect keyboard focusability from click focusability, right? (That's the main point of this CL I believe)
    2. Make scrollers just keyboard focusable. In both cases, IsFocusable() will be true.
    3. Make sure the area is still scrollable with the keyboard after a click, as it used to be, even if it is not focused
    4. Make sure AXObject::OnNativeClickAction() still sets the focus for scrollable areas. That's the function that's called when a screen reader user asks to activate something.
    5. Determine what to do for scrollableArea.focus() -- I assume this should take focus even if it is not click-focusable

    Do we need to any any tests for these?

    Mason Freed

    Yep, thanks!

    1. That's right - this CL does that.
    2. That's right, scrollers are always IsFocusable() (even when not keyboard focusable, e.g. when they have focusable content), and they are sometimes keyboard focusable. But they're not made to be mouse focusable unless they have a `tabindex`.
    3. Yes. Should be verified by tests.
    4. Is there a test that verifies this? It should be true but I'd like to confirm.
    5. Yes, since IsFocusable() is now true for all scrollers, scroller.focus() works. The new test in this CL verifies this.


    TL;DR I need help on #4 but they rest are good.

    File-level comment, Patchset 5 (Latest):
    Mason Freed . resolved

    +dbaron for the blink code

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aaron Leventhal
    • David Baron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 5
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Comment-Date: Tue, 27 Aug 2024 15:57:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Aaron Leventhal <aleve...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Aaron Leventhal (Gerrit)

    unread,
    Aug 27, 2024, 12:11:51 PM8/27/24
    to Mason Freed, David Baron, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from David Baron and Mason Freed

    Aaron Leventhal added 1 comment

    Patchset-level comments
    Aaron Leventhal . unresolved

    I'm only an owner of the a11y code. The changes to ax_object.cc look good. However, I wanted to make sure that our list of things to check (from chat) are good to go:
    1. We disconnect keyboard focusability from click focusability, right? (That's the main point of this CL I believe)
    2. Make scrollers just keyboard focusable. In both cases, IsFocusable() will be true.
    3. Make sure the area is still scrollable with the keyboard after a click, as it used to be, even if it is not focused
    4. Make sure AXObject::OnNativeClickAction() still sets the focus for scrollable areas. That's the function that's called when a screen reader user asks to activate something.
    5. Determine what to do for scrollableArea.focus() -- I assume this should take focus even if it is not click-focusable

    Do we need to any any tests for these?

    Mason Freed

    Yep, thanks!

    1. That's right - this CL does that.
    2. That's right, scrollers are always IsFocusable() (even when not keyboard focusable, e.g. when they have focusable content), and they are sometimes keyboard focusable. But they're not made to be mouse focusable unless they have a `tabindex`.
    3. Yes. Should be verified by tests.
    4. Is there a test that verifies this? It should be true but I'd like to confirm.
    5. Yes, since IsFocusable() is now true for all scrollers, scroller.focus() works. The new test in this CL verifies this.


    TL;DR I need help on #4 but they rest are good.

    Aaron Leventhal

    For #4, you can create a unit test in ax_object_test.cc.

    You can copy some of the test setup, and create a scrollable div, then:

    ```
    ui::AXActionData action_data;
    action_data.action = ax::mojom::blink::Action::kDoDefault;
      const ui::AXTreeID div_child_tree_id = ui::AXTreeID::CreateNewAXTreeID();
    action_data.target_node_id = div->AXObjectID();
    action_data.child_tree_id = div_child_tree_id;
    div->PerformAction(action_data);
    ```

    Finally, check that focus is on the div.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Baron
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 5
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Tue, 27 Aug 2024 16:11:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    Comment-In-Reply-To: Aaron Leventhal <aleve...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 27, 2024, 12:55:52 PM8/27/24
    to Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org

    Mason Freed added 1 comment

    Patchset-level comments
    Mason Freed . resolved

    -dbaron for now, I need to fix a couple issues with the test that I just noticed.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 5
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Comment-Date: Tue, 27 Aug 2024 16:55:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 27, 2024, 2:44:25 PM8/27/24
    to David Baron, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from David Baron

    Mason Freed added 1 comment

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Mason Freed . resolved

    dbaron@ ok should be ok to review now. It passes locally for me, hopefully the same on the bots.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Baron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 7
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Baron (Gerrit)

    unread,
    Aug 27, 2024, 3:42:05 PM8/27/24
    to Mason Freed, David Baron, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Mason Freed

    David Baron added 4 comments

    Commit Message
    Line 23, Patchset 7 (Latest):Bug: 361072782
    David Baron . unresolved
    File third_party/blink/renderer/core/dom/element.cc
    Line 6662, Patchset 7 (Latest): DCHECK(CanBeKeyboardFocusableScroller(update_behavior));
    David Baron . unresolved

    I think passing an `update_behavior` to a call inside of a `DCHECK()` (which I think gets removed when `!DCHECK_IS_ON()` is a bad idea, since it means that updating layout depends on `DCHECK_IS_ON()`.

    Line 6685, Patchset 7 (Latest): if (HasElementFlag(ElementFlags::kTabIndexWasSetExplicitly)) {
    // If the element has a tabindex, then that determines keyboard
    // focusability.
    return GetIntegralAttribute(html_names::kTabindexAttr, 0) >= 0;
    }
    if (!CanBeKeyboardFocusableScroller(update_behavior)) {
    // IsFocusable is true for some other reason than keyboard focusable
    // scrollers. This element should be keyboard focusable.
    return true;
    }
    David Baron . unresolved

    This (and similar code in `IsMouseFocusable`) seems fragile. It seems (if I'm understanding correctly) like it's trying to answer the question "is `CanBeKeyboardFocusableScroller` returning true the only reason that `IsFocusable` returned true". If that's the case, then would it be cleaner to give `IsFocusable` a tri-state result rather than a boolean?

    Line 6710, Patchset 7 (Latest): }
    // Otherwise, if the element `IsFocusable()`, then it should also be mouse-
    // focusable, *unless* it is a keyboard focusable scroller.
    if (!CanBeKeyboardFocusableScroller(update_behavior)) {
    return true;
    }
    return !IsKeyboardFocusableScroller(update_behavior);
    David Baron . unresolved

    This logic doesn't seem right. This is saying that if a scroller doesn't have a focusable descendant, then it's not mouse focusable (because it is keyboard focusable)... but then if a focusable descendant is added (which makes it no longer keyboard focusable) then it becomes mouse focusable. That seems a little too weird to be what we want. (Or is it?)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 7
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Tue, 27 Aug 2024 19:41:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 28, 2024, 7:54:33 PM8/28/24
    to Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, David Baron, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Aaron Leventhal and David Baron

    Mason Freed voted and added 6 comments

    Votes added by Mason Freed

    Commit-Queue+1

    6 comments

    Patchset-level comments
    File-level comment, Patchset 4:
    Aaron Leventhal . resolved
    Mason Freed

    Thanks! Done.

    File-level comment, Patchset 11 (Latest):
    Mason Freed . resolved

    Alright, thanks for the comments. In particular, dbaron@ thanks for the enum suggestion. While that makes this CL a lot bigger, it also makes the logic a lot easier to follow, so I think it's a worthwhile change. I believe the bots should pass with this patchset, but I haven't waited around to make sure. But either way, it'd be great if you could take a look and see if anything seems off.

    Commit Message
    Line 23, Patchset 7:Bug: 361072782
    David Baron . resolved
    Mason Freed

    Never done that before - thanks.

    File third_party/blink/renderer/core/dom/element.cc
    Line 6662, Patchset 7: DCHECK(CanBeKeyboardFocusableScroller(update_behavior));
    David Baron . resolved

    I think passing an `update_behavior` to a call inside of a `DCHECK()` (which I think gets removed when `!DCHECK_IS_ON()` is a bad idea, since it means that updating layout depends on `DCHECK_IS_ON()`.

    Mason Freed

    Ohh interesting catch. Ok, I ended up adding a value to the UpdateBehavior enum called `kAssertNoLayoutUpdates`, and there I just assert that the lifecycle doesn't move at all. I also cleaned up the enum just a bit and added some comments. PTAL!

    Line 6685, Patchset 7: if (HasElementFlag(ElementFlags::kTabIndexWasSetExplicitly)) {

    // If the element has a tabindex, then that determines keyboard
    // focusability.
    return GetIntegralAttribute(html_names::kTabindexAttr, 0) >= 0;
    }
    if (!CanBeKeyboardFocusableScroller(update_behavior)) {
    // IsFocusable is true for some other reason than keyboard focusable
    // scrollers. This element should be keyboard focusable.
    return true;
    }
    David Baron . resolved

    This (and similar code in `IsMouseFocusable`) seems fragile. It seems (if I'm understanding correctly) like it's trying to answer the question "is `CanBeKeyboardFocusableScroller` returning true the only reason that `IsFocusable` returned true". If that's the case, then would it be cleaner to give `IsFocusable` a tri-state result rather than a boolean?

    Mason Freed

    Yes, that's exactly what it's doing. And yes, it's a bit brittle. The issue is that doing things like making `IsFocusable` an enum spreads this knowledge out quite far, since there are many callers (over 60). I could make yet another method like `GetFocusableState` that returns the enum, then check that from `IsFocusable` and avoid changing the callers. Hmm. Maybe I'll try that...

    Ok, I ended up doing something like that. I switched to `SupportsFocus()` and `IsFocusableState()` (which is new) returning a `FocusableState` enum that includes no, yes, or KFS. That is a pretty widespread change, but I think it seems cleaner now, at least in the core `Element::Is{Mouse|Keyboard}Focusable()` routines. I also removed some of the default values for the `UpdateBehavior` enum, because it was mostly being passed around anyway.


    // Otherwise, if the element `IsFocusable()`, then it should also be mouse-
    // focusable, *unless* it is a keyboard focusable scroller.
    if (!CanBeKeyboardFocusableScroller(update_behavior)) {
    return true;
    }
    return !IsKeyboardFocusableScroller(update_behavior);
    David Baron . resolved

    This logic doesn't seem right. This is saying that if a scroller doesn't have a focusable descendant, then it's not mouse focusable (because it is keyboard focusable)... but then if a focusable descendant is added (which makes it no longer keyboard focusable) then it becomes mouse focusable. That seems a little too weird to be what we want. (Or is it?)

    Mason Freed

    Yes, I believe this was previously screwed up. Thankfully, with the new enum, the code is quite a bit easier to read, and I think I've eliminated this bug. I also fixed the test accordingly. PTAL.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aaron Leventhal
    • David Baron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 11
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Comment-Date: Wed, 28 Aug 2024 23:54:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    Comment-In-Reply-To: Aaron Leventhal <aleve...@chromium.org>
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Baron (Gerrit)

    unread,
    Aug 29, 2024, 10:08:11 AM8/29/24
    to Mason Freed, David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Aaron Leventhal and Mason Freed

    David Baron voted and added 8 comments

    Votes added by David Baron

    Code-Review+1

    8 comments

    Patchset-level comments
    File-level comment, Patchset 11 (Latest):
    David Baron . resolved

    LGTM with a few comments.

    I admit that I didn't carefully audit all the callers of `IsFocusable` to check which should be changed back to `IsMouseFocusable`. I'm a little curious how you determined that set. (It doesn't seem like it's a revert of an earlier change, based on digging through history and finding commit cc0fdaf229e85447ee197abe6e2d8d7a2b799afc.)

    Commit Message
    Line 32, Patchset 11 (Latest):
    David Baron . unresolved

    drop the blank line here -- `Co-authored-by:` should be a part of the footer along with `Bug:` and `Change-Id:`.

    File third_party/blink/renderer/core/dom/element.cc
    Line 6638, Patchset 11 (Latest): [[fallthrough]];
    David Baron . unresolved

    Do you need `[[fallthrough]];` after a `CHECK()` or does the compiler know that it never returns?

    Line 6685, Patchset 11 (Latest): auto focusable_state = Element::IsFocusableState(update_behavior);
    David Baron . unresolved

    `FocusableState` rather than `auto`

    Line 6706, Patchset 11 (Latest): auto focusable_state = Element::IsFocusableState(update_behavior);
    David Baron . unresolved

    `FocusableState` rather than `auto`

    File third_party/blink/renderer/core/html/html_anchor_element.cc
    Line 196, Patchset 11 (Latest): IsFocusableState(update_behavior) != FocusableState::kNotFocusable) {
    David Baron . unresolved

    This *could* use `IsFocusable` but it doesn't have to... ok either way, I guess.

    File third_party/blink/renderer/core/html/html_element.cc
    Line 2975, Patchset 11 (Latest): // The SupportsFocus call above will ensure style and layout is clean here.
    David Baron . unresolved

    That's not true for all overrides of the method; I think you should undo this change.

    File third_party/blink/renderer/core/html/media/html_media_element.cc
    Line 744, Patchset 11 (Latest): if (SupportsFocus(update_behavior) == FocusableState::kNotFocusable) {
    return FocusableState::kNotFocusable;
    }
    if (!IsFullscreen()) {
    return FocusableState::kFocusable;
    }
    return HTMLElement::IsFocusableState(update_behavior);
    David Baron . unresolved

    I think this could probably do a better job of propagating the `FocusableState` result. I *think* (but you should check this) that the logic boils down to:

    ```
    if (!IsFullscreen()) {
    return SupportsFocus(update_behavior);
    }
    return HTMLElement::IsFocusableState(update_behavior);
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aaron Leventhal
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 11
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Comment-Date: Thu, 29 Aug 2024 14:07:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 29, 2024, 7:29:20 PM8/29/24
    to David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Aaron Leventhal and David Baron

    Mason Freed added 8 comments

    Patchset-level comments
    David Baron . resolved

    LGTM with a few comments.

    I admit that I didn't carefully audit all the callers of `IsFocusable` to check which should be changed back to `IsMouseFocusable`. I'm a little curious how you determined that set. (It doesn't seem like it's a revert of an earlier change, based on digging through history and finding commit cc0fdaf229e85447ee197abe6e2d8d7a2b799afc.)

    Mason Freed

    I will admit that I trusted a) Di who made the patch originally, and b) the passing tests. That's a bit lazy, but based on this comment I manually walked through all callers of `IsFocusable()` (modulo tests) and didn't see anything that looked missed. There was one change I made which is debatable (and I'll need to make sure it passes tests) about dialog initial focus.

    Commit Message
    Line 32, Patchset 11:
    David Baron . resolved

    drop the blank line here -- `Co-authored-by:` should be a part of the footer along with `Bug:` and `Change-Id:`.

    Mason Freed

    Done

    File third_party/blink/renderer/core/dom/element.cc
    Line 6638, Patchset 11: [[fallthrough]];
    David Baron . unresolved

    Do you need `[[fallthrough]];` after a `CHECK()` or does the compiler know that it never returns?

    Mason Freed

    I think I still need a fallthrough, since it *does* return (fall through) in the case that the `CHECK` passes, right? (The compiler tells me I'm right... 😊)

    Line 6685, Patchset 11: auto focusable_state = Element::IsFocusableState(update_behavior);
    David Baron . resolved

    `FocusableState` rather than `auto`

    Mason Freed

    Thought it was too wordy. But ok, done.

    Line 6706, Patchset 11: auto focusable_state = Element::IsFocusableState(update_behavior);
    David Baron . resolved

    `FocusableState` rather than `auto`

    Mason Freed

    Done

    File third_party/blink/renderer/core/html/html_anchor_element.cc
    Line 196, Patchset 11: IsFocusableState(update_behavior) != FocusableState::kNotFocusable) {
    David Baron . resolved

    This *could* use `IsFocusable` but it doesn't have to... ok either way, I guess.

    Mason Freed

    Yeah, I like that better, done.

    File third_party/blink/renderer/core/html/html_element.cc
    Line 2975, Patchset 11: // The SupportsFocus call above will ensure style and layout is clean here.
    David Baron . resolved

    That's not true for all overrides of the method; I think you should undo this change.

    Mason Freed

    Yep, good point. I added a comment to keep future-me from trying to delete it again.

    File third_party/blink/renderer/core/html/media/html_media_element.cc
    Line 744, Patchset 11: if (SupportsFocus(update_behavior) == FocusableState::kNotFocusable) {

    return FocusableState::kNotFocusable;
    }
    if (!IsFullscreen()) {
    return FocusableState::kFocusable;
    }
    return HTMLElement::IsFocusableState(update_behavior);
    David Baron . resolved

    I think this could probably do a better job of propagating the `FocusableState` result. I *think* (but you should check this) that the logic boils down to:

    ```
    if (!IsFullscreen()) {
    return SupportsFocus(update_behavior);
    }
    return HTMLElement::IsFocusableState(update_behavior);
    ```
    Mason Freed

    I think I agree. Done, and we'll see if bots all pass.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aaron Leventhal
    • David Baron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 13
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Comment-Date: Thu, 29 Aug 2024 23:29:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Baron (Gerrit)

    unread,
    Aug 29, 2024, 8:21:13 PM8/29/24
    to Mason Freed, David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Aaron Leventhal, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Aaron Leventhal and Mason Freed

    David Baron voted and added 1 comment

    Votes added by David Baron

    Code-Review+1

    1 comment

    File third_party/blink/renderer/core/dom/element.cc
    Line 6638, Patchset 11: [[fallthrough]];
    David Baron . resolved

    Do you need `[[fallthrough]];` after a `CHECK()` or does the compiler know that it never returns?

    Mason Freed

    I think I still need a fallthrough, since it *does* return (fall through) in the case that the `CHECK` passes, right? (The compiler tells me I'm right... 😊)

    David Baron

    Oops, somehow I was half thinking it was a `NOTREACHED()` rather than a `CHECK()`; you definitely do still need a `[[fallthrough]]`.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Aaron Leventhal
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 13
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Comment-Date: Fri, 30 Aug 2024 00:21:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    open
    diffy

    Aaron Leventhal (Gerrit)

    unread,
    Aug 30, 2024, 10:44:49 AM8/30/24
    to Mason Freed, David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org
    Attention needed from Mason Freed

    Aaron Leventhal voted and added 1 comment

    Votes added by Aaron Leventhal

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 13 (Latest):
    Aaron Leventhal . resolved

    LGTM for ax_object* changes.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    Gerrit-Comment-Date: Fri, 30 Aug 2024 14:44:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Aug 30, 2024, 3:17:34 PM8/30/24
    to Aaron Leventhal, David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Tricium, Chromium LUCI CQ, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org

    Mason Freed voted and added 2 comments

    Votes added by Mason Freed

    Commit-Queue+2

    2 comments

    Patchset-level comments
    David Baron . resolved

    LGTM with a few comments.

    I admit that I didn't carefully audit all the callers of `IsFocusable` to check which should be changed back to `IsMouseFocusable`. I'm a little curious how you determined that set. (It doesn't seem like it's a revert of an earlier change, based on digging through history and finding commit cc0fdaf229e85447ee197abe6e2d8d7a2b799afc.)

    Mason Freed

    I will admit that I trusted a) Di who made the patch originally, and b) the passing tests. That's a bit lazy, but based on this comment I manually walked through all callers of `IsFocusable()` (modulo tests) and didn't see anything that looked missed. There was one change I made which is debatable (and I'll need to make sure it passes tests) about dialog initial focus.

    Mason Freed

    ...and coming back to this, that one "extra" call site I found turned out to break things, so I put it back. Looks like Di's original pass was correct.

    File-level comment, Patchset 14 (Latest):
    Mason Freed . resolved

    Thanks all.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 14
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Fredrik Söderquist <f...@opera.com>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Comment-Date: Fri, 30 Aug 2024 19:17:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Aug 30, 2024, 4:54:43 PM8/30/24
    to Mason Freed, Aaron Leventhal, David Baron, Stephen Chenney, srirama chandra sekhar, Fredrik Söderquist, Dirk Schulze, AyeAye, Tricium, Akihiro Ota, chromium...@chromium.org, (Julie)Jeongeun Kim, Kevin Babbitt, eric.c...@apple.com, fmalit...@chromium.org, pdr+svgw...@chromium.org, feature-me...@chromium.org, kouhe...@chromium.org, abigailbk...@google.com, aleventhal...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, dtapuska+...@chromium.org, dtseng...@chromium.org, francisjp...@google.com, hirokisa...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, yuzo+...@chromium.org

    Chromium LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    13 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: third_party/blink/renderer/core/dom/element.cc
    Insertions: 2, Deletions: 2.

    @@ -6221,9 +6221,9 @@
    for (Element& descendant : ElementTraversal::DescendantsOf(*where_to_look)) {
    // Dialog elements should only initially focus keyboard focusable elements,
    // not mouse focusable elements.
    - if (descendant.IsFocusable(UpdateBehavior::kStyleAndLayout) &&
    + if (descendant.IsFocusable() &&
    (!IsA<HTMLDialogElement>(this) ||
    - descendant.IsKeyboardFocusable(UpdateBehavior::kStyleAndLayout))) {
    + FocusController::AdjustedTabIndex(descendant) >= 0)) {
    return &descendant;
    }
    if (Element* focusable_area =
    ```

    Change information

    Commit message:
    Make KeyboardFocusableScrollers keyboard-focus but not mouse-focus

    This (re-)introduces the concept of IsMouseFocusable, which
    represents whether an element should be focused by the mouse. This
    is now distinct from IsKeyboardFocusable: elements can be one of
    these without being the other. Both require IsFocusable() to be
    true.

    This behavior is guarded behind the flag KeyboardFocusableScrollers.
    When the flag disabled, IsMouseFocusable and IsKeyboardFocusable will
    always return the same value. With the flag enabled, scrollers
    (without an explicit tabindex) will be keyboard focusable, but will
    not be mouse focusable.

    Along the way, I ended up (thanks to a comment from dbaron@) doing
    a refactor of `SupportsFocus()` and `IsFocusable()` (now called
    `IsFocusableState()`) to return a tri-state enum, which explicitly
    keeps track of whether the element supports or is focusable due to
    keyboard focusable scrollers. That ends up making the logic for
    `IsMouseFocusable()` and `IsKeyboardFocusable()` a lot easier to
    grok since there aren't hidden dependencies on the logic in
    `SupportsFocus()`. I also removed the default parameter values for
    both methods, since they were passed explicitly almost everywhere.
    Bug: 361072782
    Co-authored-by: Di Zhang <dizh...@chromium.org>
    Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Reviewed-by: David Baron <dba...@chromium.org>
    Reviewed-by: Aaron Leventhal <aleve...@chromium.org>
    Commit-Queue: Mason Freed <mas...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1349407}
    Files:
    • M third_party/blink/renderer/core/dom/container_node.cc
    • M third_party/blink/renderer/core/dom/document.cc
    • M third_party/blink/renderer/core/dom/element.cc
    • M third_party/blink/renderer/core/dom/element.h
    • M third_party/blink/renderer/core/html/fenced_frame/html_fenced_frame_element.cc
    • M third_party/blink/renderer/core/html/fenced_frame/html_fenced_frame_element.h
    • M third_party/blink/renderer/core/html/forms/clear_button_element.h
    • M third_party/blink/renderer/core/html/forms/date_time_field_element.cc
    • M third_party/blink/renderer/core/html/forms/date_time_field_element.h
    • M third_party/blink/renderer/core/html/forms/html_field_set_element.cc
    • M third_party/blink/renderer/core/html/forms/html_field_set_element.h
    • M third_party/blink/renderer/core/html/forms/html_form_control_element.cc
    • M third_party/blink/renderer/core/html/forms/html_form_control_element.h
    • M third_party/blink/renderer/core/html/forms/html_label_element.cc
    • M third_party/blink/renderer/core/html/forms/html_opt_group_element.cc
    • M third_party/blink/renderer/core/html/forms/html_opt_group_element.h
    • M third_party/blink/renderer/core/html/forms/html_option_element.cc
    • M third_party/blink/renderer/core/html/forms/html_option_element.h
    • M third_party/blink/renderer/core/html/forms/html_output_element.cc
    • M third_party/blink/renderer/core/html/forms/html_output_element.h
    • M third_party/blink/renderer/core/html/forms/html_select_element.cc
    • M third_party/blink/renderer/core/html/forms/html_select_element.h
    • M third_party/blink/renderer/core/html/forms/html_select_list_element.h
    • M third_party/blink/renderer/core/html/forms/spin_button_element.h
    • M third_party/blink/renderer/core/html/forms/text_control_inner_elements.h
    • M third_party/blink/renderer/core/html/html_anchor_element.cc
    • M third_party/blink/renderer/core/html/html_anchor_element.h
    • M third_party/blink/renderer/core/html/html_area_element.cc
    • M third_party/blink/renderer/core/html/html_area_element.h
    • M third_party/blink/renderer/core/html/html_dialog_element.cc
    • M third_party/blink/renderer/core/html/html_dialog_element.h
    • M third_party/blink/renderer/core/html/html_element.cc
    • M third_party/blink/renderer/core/html/html_element.h
    • M third_party/blink/renderer/core/html/html_frame_element_base.cc
    • M third_party/blink/renderer/core/html/html_frame_element_base.h
    • M third_party/blink/renderer/core/html/html_permission_element.cc
    • M third_party/blink/renderer/core/html/html_permission_element.h
    • M third_party/blink/renderer/core/html/html_plugin_element.cc
    • M third_party/blink/renderer/core/html/html_plugin_element.h
    • M third_party/blink/renderer/core/html/html_summary_element.cc
    • M third_party/blink/renderer/core/html/html_summary_element.h
    • M third_party/blink/renderer/core/html/media/html_media_element.cc
    • M third_party/blink/renderer/core/html/media/html_media_element.h
    • M third_party/blink/renderer/core/input/mouse_event_manager.cc
    • M third_party/blink/renderer/core/page/touch_adjustment.cc
    • M third_party/blink/renderer/core/svg/svg_a_element.cc
    • M third_party/blink/renderer/core/svg/svg_a_element.h
    • M third_party/blink/renderer/core/svg/svg_clip_path_element.h
    • M third_party/blink/renderer/core/svg/svg_defs_element.h
    • M third_party/blink/renderer/core/svg/svg_element.h
    • M third_party/blink/renderer/core/svg/svg_graphics_element.h
    • M third_party/blink/renderer/modules/accessibility/ax_object.cc
    • M third_party/blink/renderer/modules/accessibility/ax_object_test.cc
    • A third_party/blink/web_tests/shadow-dom/focus-navigation/focus-scroller-activeElement-on-event.html
    • M third_party/blink/web_tests/shadow-dom/resources/focus-utils.js
    Change size: L
    Delta: 55 files changed, 485 insertions(+), 173 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Aaron Leventhal, +1 by David Baron
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4f6e2a4f4e6b27ec637315ea17aafe6da39ef235
    Gerrit-Change-Number: 5812197
    Gerrit-PatchSet: 15
    Gerrit-Owner: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Aaron Leventhal <aleve...@chromium.org>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages