Skip to content

Conversation

@kubiix
Copy link

@kubiix kubiix commented Sep 23, 2025

This pull request adds conditional tooltip support for the tab close button and improves user feedback and interaction when closing tabs in the main screen tab bar. The most important changes are grouped below:

UI/UX Improvements:

  • Added a new WithTooltipConditional extension method to ButtonEvent in ImGuiUtils.cs, allowing tooltips to be shown only when a specified condition is met.
  • Updated the tab close button logic in MainScreenTabBar.cs to use the new conditional tooltip. The tooltip is now displayed only if the page can be deleted, enhancing clarity for users.

Localization and Feedback:

  • Added a new localized string tooltip-close-page in yafc.cfg, which provides a tooltip message for the close button, including Ctrl+Click instructions for removal.

Tab Closing Behavior:

  • Improved tab closing logic: Ctrl+Click now removes the page if it can be deleted, otherwise the tab is simply closed. This makes the behavior more intuitive and consistent with the tooltip guidance.
{933743B2-ECAF-43C2-ABDC-F3A623A63223}

@kubiix kubiix requested a review from shpaass as a code owner September 23, 2025 21:29
Copy link
Collaborator

@veger veger left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution. The change looks good to me.

Please add a changelog entry if possible, otherwise we can do it as well

@kubiix
Copy link
Author

kubiix commented Sep 23, 2025

Changelog filled


return evt;
}
public static bool WithTooltipConditional(this ButtonEvent evt, bool condition, ImGui gui, string tooltip, Rect? rect = null) {
Copy link
Owner

Choose a reason for hiding this comment

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

This function duplicates the code of WithTooltip, with the only difference of an in-built check for boolean. This function has only one usage.

Why not just check this boolean condition in a short-circuiting if before deciding if you want to show the tooltip?

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, I start to understand why, but I wonder if there's a better way. Will look into that.

Copy link
Owner

Choose a reason for hiding this comment

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

Something like the following to prevent code duplication. What do you guys think?

        if (condition) {
            return WithTooltip(evt, gui, tooltip, rect);
        }
        else {
            return evt;
        }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hiding this logic in the new function is cleaner to me, as it does not have this logic all over the place and can directly returned.

So we'd get a function bool WithTooltipConditional that returns evt

@shpaass
Copy link
Owner

shpaass commented Sep 24, 2025

In general, I try to prevent overloading UI with the QoL functionality that is rarely used. Do you really delete the pages so often that you need a shortcut for that?

@veger
Copy link
Collaborator

veger commented Sep 24, 2025

In general, I try to prevent overloading UI with the QoL functionality that is rarely used. Do you really delete the pages so often that you need a shortcut for that?

I was wondering the same, but then I figured that most users won't be aware as only the tooltip points to this. So it is not really cluttering the UI I thought...

@shpaass
Copy link
Owner

shpaass commented Sep 24, 2025

it is not really cluttering the UI I thought

It's another ever-appearing popup. This time on a closing button.

@veger
Copy link
Collaborator

veger commented Sep 24, 2025

I just tried, it is indeed 'funny' to see that a closing button closes the page...
I am not too bothered by it, but I can see you point.

Maybe adding this info to the tips of the popup is better yes.

<Unrelated> As a non-native English speaker: isn't a tip something you give you waiter? (funny side note: In Dutch a 'tip' has this intended meaning for being a piece of info you want to provide to someone.) If so, we could make another 'good first issue' to fix the naming of this file to the correct wording.

@shpaass
Copy link
Owner

shpaass commented Sep 24, 2025

isn't a tip something you give you waiter?

"tip" also has another meaning - "hint". (proof)

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