Click cell handler now triggers links

I have an application with a table, inside one of the table cells is a Link type, and I have a click handler to open a new tab URL when clicking the text only.

Some change was just rolled out, in the past 24 hours, that now when you click anywhere in the cell containing a link, it triggers the open URL!

How can I revert this, or make it so only clicking the link text opens a URL?

Hello @offpath

You have to use the onclick event on that link not on the table event handler

3 Likes

That's what I was doing, and that's precisely what changed. Because it's a cell handler and there's no way to create an actual link handler. This just changed last week.

@offpath,
Can you provide me with the exported json from your app so i can see what is happening? You can export it like this:

1 Like

We're experiencing this issue too. "Link" cells now trigger events when the cell is clicked, not when the link is clicked.

Yeah it's still broken.

My workaround (cause this is retool and they won't open-source components and take absolutely forever to actually fix things) is making the cell type HTML, and I'm inserting <a href="https://example.com" target="_blank">link text</a> to get it to work like it did before.

Hi @offpath,
A change was made because previously the event handler on click cell only triggered when clicking on the actual content in the cell and not just the white space of a cell. So the change enabled the event handlers to occur when a user clicks ANYWHERE on the cell. I have filed a ticket with our engineering team that perhaps this is good for other column types, but not the behavior that you would like to see when the column format is link.

Meanwhile, I think your workaround with the html format is excellent.

Yeah. I know. That was my bug report. Thanks for the confirmation I guess that your engineers introduced breaking behavior?

Hey @offpath,
The word from engineering is that this is now the intended behavior because what if, on a link type cell, the user wanted to add an event handler to that cell and wanted other behavior than going to a url? They would be limited, then, to only clicking on the text. So we need to enable the entire cell to be clickable. Your workaround will still allow an event handler to work, as well as clicking on the actual text to get you to the url.

I'm sorry, but this is bonkers. Imagine you put a button in the cell that triggered when users clicked near (but not on) the button. That'd be confusing! The same goes for links that behave as buttons. Clicking a link is not the same as clicking near a link. Limiting the event handler to only when a user clicks on the text is the entire point of a link.

In our implementation, users often click on "link" cells (but not the link itself) to select rows. Now, that same behavior (clicking on a cell but not a link) triggers an event that they didn't mean to trigger. It's incredibly confusing, especially when using invisible cell borders. The users are not even aware a cell exists to click on, and suddenly they've activated an event.

1 Like

@jericsinger,
Maybe I am misunderstanding. Wouldn't you just, in your workaround (the one with the a tag )
not add an event handler on your cell? Then the user would just click on the text to trigger the move to the URL and if they click on the cell itself nothing will happen. If, on the otherhand, they want OTHER behavior, then that is when you'd add an event handler.

We use the links to trigger component actions, not to open external urls, so no, the html workaround doesn't work for us. We previously used the onClick event triggering on link click (not cell click), and it worked great. I don't understand your engineer's logic here. Obviously there are use cases where app designers would want users to be able to click on a cell (but not the text within the cell) and NOT trigger an onClick event -- as in my button example and our current, now broken, use case of row selection.

Retool already has a click cell handler, on the Table object itself:

The click handler on a specific column really should be how it used to be -- It was a click handler on the contents of the cell, not the cell itself.

Now you've created two separate ways to designate an entire cell click handler, and zero ways to designate a click handler on the contents of the cell (a button, a link, an image, etc)

1 Like

Hey all - thanks for flagging this and sharing some additional context about your use cases. It's never our intention to break existing functionality and there was clearly some nuance that we missed when implementing this change.

I'm talking to the team about how to best resolve this, but it seems likely that we'll revert the change entirely. I'll follow up here as soon as I know more.

2 Likes

Hey all, the previous behavior for the Table cell click event has been restored on Retool Cloud. Apologies for the inconvenience and thanks very much for bringing this issue to our attention!

2 Likes