rstudio / rstudio/shiny-server

socket.onclose is called when a link on a page is clicked

Open
#32 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
759
Forks
290
Avg merge
20m
Merged PRs (30d)
4

Description

socket.onclose is called when a link on a page is clicked. While this makes sense from the point of handling the socket, as a consequence, the disconnect class is added to body from shiny.js:

  socket.onclose = function() {
    $(document.body).addClass('disconnected');
  };

This is undesirable when the page contains links to download files where the browser typically opens up the file for download, but at the same time disconnect class is on body (which greys out the page).

AFAIK, a workaround for this is to manually add an event for the link in question so that when it is clicked, it removes the disconnect class from body.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in shiny.js at the socket.onclose handler shown in the issue, then trace how link clicks and file downloads affect the page state. Reproduce the disconnect class being added after clicking a download link, and consider the behavior resolved when such links no longer leave the page greyed out while ordinary socket closure still indicates disconnection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.