Bug 174302 - REGRESSION(r210226): Keyboard-focused element not preserved when navigating back through page cache, causing multiple elements to have focus
Summary: REGRESSION(r210226): Keyboard-focused element not preserved when navigating b...
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P1 Normal
Assignee: Andreas Kling
URL: data:text/html,<a%20href="about:blank...
Keywords: InRadar, Regression
Depends on:
Reported: 2017-07-09 15:00 PDT by mitz
Modified: 2017-07-10 10:03 PDT (History)
10 users (show)

See Also:

Patch (4.29 KB, patch)
2017-07-10 07:14 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2017-07-09 15:00:09 PDT
To reproduce:

1. Navigate to the URL.
2. Press Option-Tab three times to focus the 3 link
3. Press Return to navigate
4. Navigate back
5. Notice that the 3 link still looks focused, but pressing Return doesn’t navigate to it
6. Press Option-Tab twice
7. Notice that the 1 link, then the 2 link become focused, but the 3 link also looks focused
8. Press Return to navigate, then navigate back
9. Notice that the 2 link and the 3 link still look focused

This is a regression from shipping Safari.
Comment 1 Radar WebKit Bug Importer 2017-07-09 15:00:52 PDT
Comment 2 Andreas Kling 2017-07-10 02:16:17 PDT
Regressed with https://trac.webkit.org/r210226
Comment 3 Andreas Kling 2017-07-10 04:03:29 PDT
I think I see the problem here. Document::destroyRenderTree() is clearing the various DOM pointers to "user action elements", including the currently focused element.

This feels like a red patch, just need to write a test case. Thanks mitz for the really great bug report!
Comment 4 Andreas Kling 2017-07-10 07:14:10 PDT
Created attachment 314977 [details]
Comment 5 WebKit Commit Bot 2017-07-10 10:03:18 PDT
Comment on attachment 314977 [details]

Clearing flags on attachment: 314977

Committed r219296: <http://trac.webkit.org/changeset/219296>
Comment 6 WebKit Commit Bot 2017-07-10 10:03:20 PDT
All reviewed patches have been landed.  Closing bug.