Skip to content

Allow actions show-next-tab and previous to loop#5355

Merged
knolleary merged 2 commits intonode-red:masterfrom
GogoVega:improve-next-previous-tab-action
Jan 5, 2026
Merged

Allow actions show-next-tab and previous to loop#5355
knolleary merged 2 commits intonode-red:masterfrom
GogoVega:improve-next-previous-tab-action

Conversation

@GogoVega
Copy link
Copy Markdown
Contributor

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Request: https://discourse.nodered.org/t/show-next-previous-tab-should-wrap/99696

Allow actions show-next-tab and show-previous-tab to loop; returns to the first tab if we have reached the end, and vice versa.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@dceejay
Copy link
Copy Markdown
Member

dceejay commented Nov 17, 2025

How do I go back to first tab without overshooting ? ( as the first tab loads first I put initialisation nodes on there )

@GogoVega
Copy link
Copy Markdown
Contributor Author

I don't understand the question.

If I have the following three tabs: A, B, and C. I'm on tab B (the active one), I click next, I'm on tab C. If I click next again, I'm back on tab A. If I click previous, I'm back on tab C...

By click I mean trigger the action.

@dceejay
Copy link
Copy Markdown
Member

dceejay commented Nov 17, 2025

If I have a bunch of tabs currently I can just click the left arrow a load of times without paying attention and know I will end up on the first one. With this fix I'll have to count exactly

@GogoVega
Copy link
Copy Markdown
Contributor Author

We can add show-first-tab and show-last-tab actions to solve that 😉

@gdvine
Copy link
Copy Markdown

gdvine commented Nov 18, 2025

We can add show-first-tab and show-last-tab actions to solve that 😉

I agree with Gogo that this is the proper solution! 🙏

Copy link
Copy Markdown
Member

@knolleary knolleary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The findNext/PreviousVisibleTab utilities functions are used for more than just navigating. Having them wrap will cause unexpected behaviours elsewhere.

Instead of changing those functions, the wrapping logic should be done in activateNext/PreviousTab

@GogoVega
Copy link
Copy Markdown
Contributor Author

GogoVega commented Dec 7, 2025

the wrapping logic should be done in activateNext/PreviousTab

Done 🙃

@knolleary knolleary merged commit 92ca0ee into node-red:master Jan 5, 2026
5 checks passed
@GogoVega GogoVega deleted the improve-next-previous-tab-action branch January 5, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants