Preserve focus when entering the back-forward cache [chromium/src : main]

1 view
Skip to first unread message

Helmut Januschka (Gerrit)

unread,
May 24, 2026, 7:14:34 PM (2 days ago) May 24
to Helmut Januschka, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, chikamu...@chromium.org, bfcach...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar

Helmut Januschka added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Helmut Januschka . resolved

@jar...@chromium.org - PTAL, do you have an idea who would be a good reviewer?

thanks in advance, and no time pressure from my end, whenver you have a couple of minutes. thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
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: Id42617b17da46656f35c855eea02a8df848543e0
Gerrit-Change-Number: 7829940
Gerrit-PatchSet: 2
Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Sun, 24 May 2026 23:14:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fergal Daly (Gerrit)

unread,
May 24, 2026, 7:55:48 PM (2 days ago) May 24
to Helmut Januschka, Fergal Daly, Fergal Daly, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, chikamu...@chromium.org, bfcach...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Fergal Daly, Helmut Januschka and Joey Arhar

Fergal Daly added 1 comment

File content/browser/back_forward_cache_browsertest.cc
Line 1879, Patchset 2 (Parent): // 5) Navigating back to |url_1|, we shouldn't restore the focus to the
Fergal Daly . unresolved

Do you know why we were testing for the opposite behaviour? Does the HTML spec have an opinion on this?

Open in Gerrit

Related details

Attention is currently required from:
  • Fergal Daly
  • Helmut Januschka
  • Joey Arhar
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: Id42617b17da46656f35c855eea02a8df848543e0
    Gerrit-Change-Number: 7829940
    Gerrit-PatchSet: 2
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Fergal Daly <fer...@google.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Fergal Daly <fer...@chromium.org>
    Gerrit-Attention: Fergal Daly <fer...@google.com>
    Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Comment-Date: Sun, 24 May 2026 23:55:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fergal Daly (Gerrit)

    unread,
    May 24, 2026, 8:05:15 PM (2 days ago) May 24
    to Helmut Januschka, Fergal Daly, Fergal Daly, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, chikamu...@chromium.org, bfcach...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fergal Daly, Helmut Januschka and Joey Arhar

    Fergal Daly added 1 comment

    File third_party/blink/web_tests/http/tests/back-forward-cache/focus-preserved.html
    Fergal Daly . unresolved

    https://wpt.fyi/results/html/browsers/browsing-the-web/back-forward-cache/focus.html?label=master&label=experimental&aligned&q=html%2Fbrowsers%2Fbrowsing-the-web%2Fback-forward-cache

    already seems to test the same thing (at least by its description). It's also failing on Firefox, so I wonder if there is consensus on the behaviour.

    Gerrit-Comment-Date: Mon, 25 May 2026 00:04:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Helmut Januschka (Gerrit)

    unread,
    May 25, 2026, 4:32:42 PM (10 hours ago) May 25
    to Helmut Januschka, Zhe Su, Fergal Daly, Fergal Daly, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, keithle...@chromium.org, creis...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, navigation...@chromium.org, tranbaod...@chromium.org, chikamu...@chromium.org, bfcach...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fergal Daly, Fergal Daly and Joey Arhar

    Helmut Januschka added 2 comments

    File content/browser/back_forward_cache_browsertest.cc
    Line 1879, Patchset 2 (Parent): // 5) Navigating back to |url_1|, we shouldn't restore the focus to the
    Fergal Daly . resolved

    Do you know why we were testing for the opposite behaviour? Does the HTML spec have an opinion on this?

    Helmut Januschka

    The opposite expectation (`blurCount == 1`) was added in 2020 by https://crrev.com/c/2362046, intentionally clearing focus + text-input state on BFCache entry so the IME / text-input plumbing matched a normal cross-document navigation. The test was just locking in that implementation choice; not a spec requirement.

    File third_party/blink/web_tests/http/tests/back-forward-cache/focus-preserved.html
    Fergal Daly . unresolved

    https://wpt.fyi/results/html/browsers/browsing-the-web/back-forward-cache/focus.html?label=master&label=experimental&aligned&q=html%2Fbrowsers%2Fbrowsing-the-web%2Fback-forward-cache

    already seems to test the same thing (at least by its description). It's also failing on Firefox, so I wonder if there is consensus on the behaviour.

    Helmut Januschka

    Acknowledged, dropped `third_party/blink/web_tests/http/tests/back-forward-cache/focus-preserved.html`.

    On consensus: Safari already preserves focus across BFCache, so this CL aligns Chromium with WebKit. Firefox is the other outlier then. The HTML spec is silent about it (`reactivate a Document` says nothing about focus).

    I'm happy to file a spec issue to make this explicit. Want me to file it as a follow-up to this CL, or block on it?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fergal Daly
    • Fergal Daly
    • Joey Arhar
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: Id42617b17da46656f35c855eea02a8df848543e0
    Gerrit-Change-Number: 7829940
    Gerrit-PatchSet: 3
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Fergal Daly <fer...@google.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Fergal Daly <fer...@chromium.org>
    Gerrit-CC: Zhe Su <su...@chromium.org>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Attention: Fergal Daly <fer...@chromium.org>
    Gerrit-Comment-Date: Mon, 25 May 2026 20:32:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fergal Daly (Gerrit)

    unread,
    May 25, 2026, 9:00:22 PM (6 hours ago) May 25
    to Helmut Januschka, Zhe Su, Fergal Daly, Fergal Daly, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, nona+...@chromium.org, shuche...@chromium.org, keithle...@chromium.org, creis...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, navigation...@chromium.org, tranbaod...@chromium.org, chikamu...@chromium.org, bfcach...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Fergal Daly, Helmut Januschka and Joey Arhar

    Fergal Daly added 1 comment

    File third_party/blink/web_tests/http/tests/back-forward-cache/focus-preserved.html
    Fergal Daly . unresolved

    https://wpt.fyi/results/html/browsers/browsing-the-web/back-forward-cache/focus.html?label=master&label=experimental&aligned&q=html%2Fbrowsers%2Fbrowsing-the-web%2Fback-forward-cache

    already seems to test the same thing (at least by its description). It's also failing on Firefox, so I wonder if there is consensus on the behaviour.

    Helmut Januschka

    Acknowledged, dropped `third_party/blink/web_tests/http/tests/back-forward-cache/focus-preserved.html`.

    On consensus: Safari already preserves focus across BFCache, so this CL aligns Chromium with WebKit. Firefox is the other outlier then. The HTML spec is silent about it (`reactivate a Document` says nothing about focus).

    I'm happy to file a spec issue to make this explicit. Want me to file it as a follow-up to this CL, or block on it?

    Fergal Daly

    Unfortunately, I think we should block. The focus behaviour was added very intentionally.

    https://crrev.com/c/2362046

    and there's a real question as to what the correct behaviour should be. There's a tension with BFCache between making it seem exactly like a normal navigation just faster and the fact that web pages are stateful and we are restoring that state.

    I'm also hesistant to change focus stuff. I know we already have a mess because input events are not on the same mojo pipe as RFH and other navigation events, including focus. I feel like this has been a source of flakiness, although it was quite a while ago.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fergal Daly
    • Helmut Januschka
    • Joey Arhar
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    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: Id42617b17da46656f35c855eea02a8df848543e0
    Gerrit-Change-Number: 7829940
    Gerrit-PatchSet: 3
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Fergal Daly <fer...@google.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Fergal Daly <fer...@chromium.org>
    Gerrit-CC: Zhe Su <su...@chromium.org>
    Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
    Gerrit-Attention: Fergal Daly <fer...@google.com>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Comment-Date: Tue, 26 May 2026 00:59:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Helmut Januschka <hel...@januschka.com>
    Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages