Issue Bug Closed

#105104Preview button in page module does not focus() preview browser tab/window if same resource

Claus Due 09/24/24, 14:24 updated 12/02/25, 14:33

Description

In window-manager.js a special condition is added which checks if the browser is trying to open a URL that is already open when a user clicks the “view” button in the page layout module header.

If this is the case, a special logic path is used which reloads that other tab/window’s URL – instead of calling window.open().

Unfortunately, this special logic path does NOT call focus() on the target window like the standard code path will do.

The result is that if you’re clicking the “view” button but already have a window/tab open with that resource, then that other window/tab is reloaded but is not focused.

(this problem does not exist for the “view” button in the formengine edit form which uses a completely different method for opening the new window/tab).

The behavior should be consistent regardless of which “view” button is clicked and whether or not a window/tab already exists. The good UX solution appears to be that both code paths in window-manager.js should call focus() on the target window.

Code in question:

if (Utility.urlsPointToSameServerSideResource(n, l)) return i.location.replace(n), i.location.reload(), i;

Suggested replacement:

if (Utility.urlsPointToSameServerSideResource(n, l)) return i.location.replace(n), i.location.reload(), i.focus(), i;

Reviews 3

History 511

  1. Garvin Hicking changed category 09/24/24, 14:43

  2. Gerrit Code Review pushed patch set 1 for main to change 86303 status New Under Review 09/24/24, 19:18

  3. Gerrit Code Review pushed patch set 1 for 12.4 to change 86314 09/24/24, 19:20

  4. Garvin Hicking commented 09/24/24, 19:20

    Thanks! I think the patch for this is relatively straight-forward, however for me on both Chrome and Firefox on macOS, the tabs were already focussed for me. Could you tell in which browser you can reproduce this, and do you have a specific tab/window configuration for it?

  5. Gerrit Code Review pushed patch set 2 for main to change 86303 10/18/24, 13:55

  6. Gerrit Code Review pushed patch set 2 for 12.4 to change 86314 10/18/24, 13:55

  7. Gerrit Code Review pushed patch set 3 for main to change 86303 11/04/24, 14:52

  8. Garvin Hicking commented 11/04/24, 15:13

    @NamelessCoder Could you maybe check out https://review.typo3.org/c/Packages/TYPO3.CMS/+/86303 if that works for you? Thanks.

  9. Gerrit Code Review pushed patch set 1 for 13.4 to change 86869 11/04/24, 16:56

  10. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % 11/04/24, 18:10

    Applied in changeset commit:b182f914d866d7208277857374a4100569b127e2.

  11. Benni Mack changed status Resolved Closed 12/02/25, 14:33