WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
254 stars 204 forks source link

Sketchfab single result loading adds to browser session history #3816

Open zackkrida opened 9 months ago

zackkrida commented 9 months ago

Description

tl;dr: You have to press the back button twice to return to the search results after viewing a Sketchfab single result

Details

In Firefox, the deferred loading of the Sketchfab script or iframe (TBD) pushes an extra, blank state into the browser session history. This causes the user to have to press the browser back button twice when returning to the search results.

Reproduction

  1. Search https://openverse.org for images, filtered by the Sketchfab provider (example
  2. Select a single result
  3. After the result loads, use the browser back button to return to search results
  4. Observe that the button needed to be pressed twice

Screenshots

A video of some of the behavior:

Screencast from 2024-02-20 22-31-43.webm

Environment

Additional context

This is most likely related to the custom approach we're taking to dynamically load the Sketchfab viewer javascript and render the iframe. Perhaps some new security feature in Firefox or other async loading functionality has caused this behavior.

The relevant component: https://github.com/WordPress/openverse/blob/ea17972522d59a56dec2f08e8a2fa68230992dcc/frontend/src/components/VSketchFabViewer.vue

And the file for dynamic script loading: https://github.com/WordPress/openverse/blob/ea17972522d59a56dec2f08e8a2fa68230992dcc/frontend/src/components/VSketchFabViewer.vue

szymon-polaczy commented 4 months ago

Hi, Is still a valid issue @zackkrida?

I tested the sketchfab images on these firefox browsers 127.0.2 (64-bit) & 115.13.0esr (64-bit) I also didn't see this issue on brave Version 1.67.134 Chromium: 126.0.6478.186 (Official Build) (64-bit)

I did those on Linux MInt 21.3 x86_64 so there shouldn't really be any major differences there.

If you're able to reproduce the issue could you send over the list of addons that you have in the browser that you tested? It might be that there is an issue there

Thanks

zackkrida commented 4 months ago

Hi @szymon-polaczy I am still seeing the issue in firefox on 128.0 (64-bit) without any addons or extensions enabled. After the sketchfab player loads, if I hit the back button once the page does not go back to the search view, rather the sketchfab player is removed, leaving a white screen like this:

https://github.com/user-attachments/assets/d85c8d57-3aa9-4eaa-a163-c5c99713ad31