RED.tabs - Request to add a method for disabling/enabling tabs

Enabling and disabling tabs is really rather more difficult than it should be. Is there any chance of adding these as methods to RED.tabs?

As Steve pointed out in the other thread, a tab can be disabled/enabled using CSS pointer-events. That doesn't disable all of the contents of course, only being able to access them. But I think that is generally enough.

To disable:

$(`#red-ui-tab-${tab.id}`).css('pointer-events', 'none')
$(`#red-ui-tab-${tab.id} > a`).css('color', 'var(--nr-db-disabled-text)')

and enable with:

$(`#red-ui-tab-${tab.id}`).css('pointer-events', 'auto')
$(`#red-ui-tab-${tab.id} > a`).css('color', 'var(--nr-db-dark-text)')

So not terribly difficult to do - once you've discovered the trick! But it took me far too long to get there.

Hi Julian,
I use a similar workaround in some of my nodes. Would indeed be nice if it was available as a function.
Because I always forget in which nodes I have used it, to be able to copy my code snippet. But now at least I can find it here :wink:
Thanks for sharing it!
Bart

Makes sense to me.

Happy to review a PR, otherwise I'll try take a look before the 2.1 release.

2 Likes

Bit too deep into restructuring some deep and knarly bits of uibuilder just now but if I get some time, I'll have a go.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.