Right Click + Open in new tab

How do I make it so I can right click on a button or element and select open in new tab? I have a link added to the element, but the option doesn’t show up when I right click in the browser.

Did you also try this on the published website? Link can be rendered differently on the editor due to the iframe preview.

It doesn’t seem to show up on the published site. Does it matter if its a published .wewed preview site? Or does it have to be fully deployed on my own domain?

@aurelie @Joyce Any ideas for how to make right click or ctrl/cmd clicking to open in new tab?

Any button with a set link and the option to open in a new tab should work.

If you go to the Academy and right click on the XANO button you will see that it’s possible

image

@luka So it only works on buttons?

I set a div up with a link and it doesn’t work.

Screenshot 2023-07-28 at 12.50.13 PM

Screenshot 2023-07-28 at 12.47.31 PM

After some checking, this is because the right click options only work on <a> tags and when you set a link on a div, it still remains a div.

We will take a look if we can handle this in a better way

3 Likes

Indeed, I’ve had similar issues with onclick workflows, but that’s to be expected. Links should definitely work tho :smiley:

2 Likes

To be honest, it really should be able to work with on click workflows too. Hopefully the fix that.

2 Likes

I think the product team had that in mind already @BuildLikePeter but just created a ticket with your suggestions in case they didn’t! :smile:

I think you can make a workflow yourself to fix this. It might be fairly simple. You need to create a global workflow with some JS and then just use it onclick each time inserting your url as a parameter.

What elements count as an “< a > tag”?

A fix is in QA, you should be able to have the right click on every item you put a link.

Glad to hear about this change. Is there any way to run a workflow before the new url gets triggered?

You have an “on page unload” trigger on every page

It’s now in production :slight_smile:

For every link to parameter, it’s an <a> tag

First, is there documentation on how the “on page unload” trigger works? I want to know more about when it triggers, and how its presence effects the loading of the next page.

Second, my use case is that I want to set some info to variables regarding an item selected from a collection list. I’m doing this so that the set variables are available instantly when the next page loads, rather than having to wait for an API to run and return that info.

Right now I have a workflow that runs when that item is selected the variables get set, and then the link triggers. Doing it this way gives me access to the info of the selected item, but won’t allow me to right click open and still run the workflow.

If I use page unload, how do I identify which item was clicked? And will that workflow run before the next page loads?

With WeWeb being a Vue.js app at the end of the day, this is what a lifecycle of it might look from what I was able to find. It’s for components, but might work similarly for like, the app itself?

1 Like

Yes, the lifecycle is very similar but we have many specific things. Thanks for bringing up people would benefit from a clear WeWeb lifecycle schema :slight_smile:

@BuildLikePeter unload workflow will happens before leaving the page. It can allow you to store data or prevent to leave the page if you’re editing something for example (by showing a popup) and throwing an error you can stop the navigation.

But in your case it will not help you, because if you open the link in a new tab you’re not leaving the page. I don’t know if there is a way to store information before a right click and open in a new tab to be honest, even with custom javascript :thinking:

Little exploration : Ok seems to be possible to listen when the context menu is clicked so maybe we should add this as a possible trigger, so you could save the last item receiving a right click for exemple.
But I’m pretty sure you can accomplish the same thing right now using the on focus trigger. Right click will trigger the on focus.

Thank you Alexis! That is extremely helpful. Thank you for your patience with me.

I agree that a “on right click” trigger would be great. I like the idea of using the on focus. The only issue with that is it would likely result in 100s of workflows being triggered as the cursor moves across the list/table. Not sure what the implications for performance would be. Also not sure how it would work on mobile.