Skip to content
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

Hide workspace tab on middle mouse click #4657

Merged
merged 4 commits into from May 3, 2024
Merged

Conversation

Steve-Mcl
Copy link
Contributor

Types of changes

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

Proposed changes

This was not discussed but rather I was tired of firing up new browser tabs when attempting to close a node-red tab with middle clicking (muscle memory issue tbf)

This PR aligns the behaviour of node-red tabs with how most tabbed environments behave.

I appreciate this was not discussed and it is such a small simple change - i would not be super upset if it was dismissed on those grounds (but hopeful it is accepted of course ;) )

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

@knolleary
Copy link
Member

Previous feedback on hiding tabs via the button we added to the tab was that it was too easy to accidentally hide a tab without realising. I fear this will have much the same effect.

It could be applied to subflow tabs that do have the explicit 'close' icon added.

Regardless, the proposed change is not appropriate as it applies to all users of the common tabs UI component. Many uses, such as the sidebar, the broker config node edit dialog etc, use this component but do not allow tabs to be hidden.

If we support this, it needs to only apply to closable tabs.

I'd personally also add it to the existing click handler rather than add another auxclick one - especially as you're having to test which button it was anyway.

@Steve-Mcl
Copy link
Contributor Author

I will revise.

I had spotted this was for all tabs, and I did try the middle click on other tabs - they did not close (so I figured, why complicate it) but on reflection, you are right it should be specific to workspace tabs.

As for "accidentally hide a tab" i feel this is far more deliberate and intended 🤷

I'll fix it up over the weekend and let you decide 🤞

@Steve-Mcl
Copy link
Contributor Author

@knolleary

I re-did this to use the existing click handler on the workspace tabs only.

Additionally, it calls the RED.action so that all the correct handlers are called (and things like the hiddenTabs stack is populated etc)

@Steve-Mcl Steve-Mcl changed the title close tab on middle mouse click Hide tab on middle mouse click Apr 29, 2024
@Steve-Mcl Steve-Mcl changed the title Hide tab on middle mouse click Hide workspace tab on middle mouse click Apr 29, 2024
Copy link
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.

Looks good - have proposed (and will self-merge) a couple inline comments about what the auxclick handlers are doing as it wasn't immediately obvious until I checked to see what happens if they weren't set 😉

@knolleary knolleary merged commit 598b0c8 into dev May 3, 2024
3 checks passed
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.

None yet

2 participants