Skip navigation
With the new Navigation API, you can now show the native spinner + stop button for any asynchronous…
0:00 / 0:23

With the new Navigation API, you can now show the native spinner + stop button for any asynchronous…

Jason Miller 🦊⚛

@_developit64K followers

Visit on X
2,706 likesDownloadOriginal post

332,236 views

With the new Navigation API, you can now show the native spinner + stop button for any asynchronous operation - all you need is a Promise.

10 Comments

Comments from the original post on X (Twitter)

  • sam "zero​width​space" thor's profile picture

    @samthor

    I've been doing this for years!

    18 likes

  • Jason Miller 🦊⚛'s profile picture

    @_developit

    isn't there an iframe version of this approach as well? I seem to recall doing the opposite (using a hidden iframe for <form> post) decades ago, and being annoyed that the loading spinner kept toggling on/off.

    2 likes

  • Thomas Shaddox's profile picture

    @tshddx

    More about this here:

    8 likes

  • Domenic Denicola's profile picture

    @domenic

    @mathias I'm a little worried about the accessibility announcement this will generate... Maybe it's fine if you're largely using it for full-page effects that deserve a "loading" announcement anyway?

    4 likes

  • Andreas Finger's profile picture

    @mediafinger

    Please only do this with sufficient delay (300ms or so) to allow for most round-trips on a good connection to resolve before showing the spinner on every click! Otherwise your page will feel slower and somehow broken.

    3 likes

  • Gustavo's profile picture

    @gustavo_pch

    Now let’s wait for Safari as it’s not polyfillable 🙃

    2 likes

  • Éliette 🏳️‍⚧️ @elipriaulx.bsky.social's profile picture

    @elipriaulx

    @noseratio Is there a chance you could click the 'stop loading' button a fraction too late and inadvertently refresh the page?

    2 likes

  • Robert Vitonsky's profile picture

    @rob_vitonsky

    Wow, it's disgusting. Now user even can't be sure the cause of appearing of this spinner. Because it may be because resources still loading (default behavior) or maybe some developer enable it just for fun or due to bug

    1 like

  • Ricardo B�nffy -'s profile picture

    @0xDEADBEEFCAFE

    I can't avoid hating this idea - the spinner and everything outside the page belongs to the browser user and needs to reflect the browser's state. These UI elements need to be trusted by the user and making them accessible this way to code on the page breaks that trust.

    1 like

  • Ryan Rampersad's profile picture

    @ryanmr

    very cool