Skip to content

Add button to stop page load - #282609

Open
Joaquín Ruales (jruales) wants to merge 41 commits into
mainfrom
jruales/s2025.12-add-stopload-button
Open

Add button to stop page load#282609
Joaquín Ruales (jruales) wants to merge 41 commits into
mainfrom
jruales/s2025.12-add-stopload-button

Conversation

@jruales

@jruales Joaquín Ruales (jruales) commented Dec 11, 2025

Copy link
Copy Markdown
Contributor
  • Adds "X" button to stop loading a website. This button shows instead of the reload button when the page is loading.
  • Adds Escape key keybinding for the above action
    • Note: unlike other browser keybindings we've added, we don't prevent default, so that the page doesn't lose access to the Esc key
  • When we stop loading a page, we don't show a fatal error. Instead, we ignore errors and just leave the page in a partially loaded state, as browsers normally do
Screen.Recording.2025-12-10.at.5.50.24.PM.mov

Added after the above video was recorded:

  • Refresh button cooldown period to match Edge and Chrome behavior:
    • Add cooldown period of 500ms after clicking the reload button before it turns into the cancel button, to prevent accidental load cancellation when double-clicking
    • Reset the cooldown if the user moves the mouse out of the toolbar

Comment thread src/vs/platform/browserView/electron-main/browserView.ts Outdated
Comment thread src/vs/platform/browserView/electron-main/browserView.ts

// No-op if we're in the cooldown period (prevents accidental double-click double reload)
if (inCooldownPeriod) {
return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do this in the model? i.e. have it optimistically set itself to loading: true / false, and prevent sending the event from there. Then maybe we can remove the timeout too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we need to keep the timeout is that I'm trying to achieve is an experience similar to Chrome and Edge, where there's a delay between clicking on the reload button and the time when the reload button turns into the Stop Loading button. We also don't want to mess with the loading state itself because we don't want this 500ms cooldown to apply to other aspects, such as showing the loading spinner.

I can however remove this no-op-enforcing code, since the most important part of the cooldown isn't to prevent double reloads, but rather to prevent accidental Stop Loading after a reload. I'll remove this now.

Please let me know if there's anything else you would suggest here.

Base automatically changed from kycutler/rich-browser to main January 8, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants