Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect the current URL in the browser navigation bar #5

Open
adamziel opened this issue Sep 21, 2022 · 9 comments
Open

Reflect the current URL in the browser navigation bar #5

adamziel opened this issue Sep 21, 2022 · 9 comments
Labels
[Aspect] Browser [Type] Enhancement New feature or request [Type] Reliability Playground uptime, reliability, not crashing

Comments

@adamziel
Copy link
Collaborator

At the moment, the top URL bar only says index.html, and all the navigation happens inside of an iframe. It would be great to have a feature that would update the top-level navigation, perhaps via pushState. It needs to be optional because updating top-level navigation doesn't make sense in contexts like runnable code examples.

@gziolo
Copy link
Member

gziolo commented Sep 22, 2022

It needs to be optional because updating top-level navigation doesn't make sense in contexts like runnable code examples.

Yes, that would definitely make sense only in the context of the npm run dev where you don't have any other way to change the URL. Actually, that was my primary issue – I wanted to navigate to a specific URL.

@adamziel
Copy link
Collaborator Author

I wanted to navigate to a specific URL.

This is now easy with wordpress-browser.html that has an address bar widget.

It could also work in a seamless mode via pushState(), but the service worker would have to be smart about page refreshes. At the moment, it would attempt to forward the request to WordPress, but it wouldn't find any instance. WordPress only lives as long as a tab with wordpress.html open.

The ServiceWorker would have to be smart about handling different types of requests:

  • Iframe-originating requests: forward to a running WordPress instance
  • Top-level requests: Create a new HTML page where a new WordPress instance would be started, use it to handle the original request

@adamziel adamziel changed the title [Browser] Reflect the current URL in the browser navigation bar Reflect the current URL in the browser navigation bar Oct 22, 2022
@krishenriksen
Copy link

@adamziel
Copy link
Collaborator Author

adamziel commented Nov 6, 2022

@krishenriksen good explorations! One tough nut to crack there is handle page refreshing. I haven't actually tested that commit, but I noticed it doesn't alter the service worker code, which means that refreshing the page or sending someone the link will display an error page – see my previous comment in this issue. Do you have any ideas how to approach that?

@krishenriksen
Copy link

@adamziel I am looking into page refresh, but an obstacle we / I must overcome first, is storing the db in indexeddb, so any page refresh will maintain changes.

@adamziel
Copy link
Collaborator Author

adamziel commented Nov 6, 2022

@krishenriksen I’d say data persistence is a separate issue from refreshing the page after pushState. Definitely worth addressing, too! Using IDBFS instead of the currently used MEMFS could help with that one.

@akirk
Copy link
Member

akirk commented Dec 9, 2024

Now that we have persistency, it would be great to work on this. This would mean that Playground could allow for a useful seamless mode and alos be more resistent to accidental reloads. If you reload the whole page in the browser by accident then we could at least navigate to the same page back again.

@akirk akirk added [Type] Enhancement New feature or request [Type] Reliability Playground uptime, reliability, not crashing and removed [Priority] Low labels Dec 9, 2024
@adamziel
Copy link
Collaborator Author

adamziel commented Dec 10, 2024

@akirk Counterpoint: you couldn't refresh the page to scrap your temporary site and start over from the same blueprint. We'd need a different behavior for temporary sites and stored sites, and that sounds confusing.

@bgrgicak
Copy link
Collaborator

@akirk Counterpoint: you couldn't refresh the page to scrap your temporary site and start over from the same blueprint. We'd need a different behavior for temporary sites and stored sites, and that sounds confusing.

What if we introduce subdirectories /site-slug/ that will open saved sites in seamless mode?

The idea is that you could go to playground.wordpress.net/my-site/wp-admin/ and it would always open the same site and page.
The main drawback I can think of is that It wouldn't allow us to use the query API, but it would be a more "natural" experience of using WordPress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Browser [Type] Enhancement New feature or request [Type] Reliability Playground uptime, reliability, not crashing
Projects
None yet
Development

No branches or pull requests

5 participants