Skip to content

[dashboard] opening a context from the stopping/stopped screen does not work #3707

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

Closed
akosyakov opened this issue Apr 1, 2021 · 4 comments
Closed
Assignees
Labels
component: dashboard type: bug Something isn't working

Comments

@akosyakov
Copy link
Member

Bug description

See below.

Steps to reproduce

See below.

Expected behavior

No response

Example repository

No response

Screenshot 2021-04-01 at 13 44 10

Screenshot 2021-04-01 at 13 44 13

@akosyakov akosyakov added type: bug Something isn't working component: dashboard labels Apr 1, 2021
@akosyakov akosyakov added this to the March 2021 milestone Apr 1, 2021
@jankeromnes
Copy link
Contributor

Oh, is that because the link is inside the iframe? 👀

In that case, a potential fix could be to handle the link click with a onClick postMessage based redirect.

@akosyakov
Copy link
Member Author

We used to have code which will send a message to the top window here:

const serverOrigin = startUrl.url.origin;
const relocateListener = (event: MessageEvent) => {
if (event.origin === serverOrigin && event.data.type == 'relocate' && event.data.url) {
window.removeEventListener('message', relocateListener);
window.location.href = event.data.url;
}
};
window.addEventListener('message', relocateListener, false);

i.e. any link from iframe should post a message to the top window instead of directly changing window location

@jankeromnes
Copy link
Contributor

Indeed, the code is still there:

redirectTo(url: string) {
if (this.runsInIFrame()) {
window.parent.postMessage({ type: 'relocate', url }, '*');
} else {
window.location.href = url;
}
}

I'm hesitating between a "sophisticated" fix (<a href="javascript:void(0)" onClick={()=>this.redirectTo('...') />, doesn't support Cmd+Click) and a "cheap" fix (<a href="..." target="_blank" />, doesn't support Click). Any preference?

@jankeromnes
Copy link
Contributor

Oh, target="_parent" looks promising: https://stackoverflow.com/a/19325592/3461173

jankeromnes added a commit that referenced this issue Apr 2, 2021
pavan-tri pushed a commit to trilogy-group/gitpod that referenced this issue Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dashboard type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants