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

Add RTL Support for Chevron Icons in LazyTreeIcons Defaults #721

Closed
wants to merge 2 commits into from

Conversation

kdroidFilter
Copy link

This pull request adds support for right-to-left (RTL) layout direction in the LazyTreeIcons.Companion.defaults function of the Jewel theme for JetBrains. Previously, the chevron icons used in the tree structure did not account for layout direction, leading to incorrect icon orientation in RTL contexts. This update ensures that the chevron icons adjust dynamically based on the current layout direction.

The function now adjusts the chevronCollapsed icon according to the current layout direction, supporting both Left-to-Right and Right-to-Left orientations. This ensures the icons correctly reflect the visual directionality context, enhancing user interface consistency.
@rock3r rock3r requested review from rock3r and hamen December 10, 2024 10:28
@rock3r rock3r added the bug Something isn't working label Dec 10, 2024
@rock3r
Copy link
Collaborator

rock3r commented Dec 10, 2024

Thanks @kdroidFilter — looks like the CI is not passing. Can you run the check task locally and fix the issues it finds? Thanks!

@kdroidFilter
Copy link
Author

@rock3r Ok, I'm trying to do this tonight

@rock3r
Copy link
Collaborator

rock3r commented Dec 10, 2024

Much appreciated, thanks!

Updated the `defaults` function in `IntUiLazyTreeStyling` to include `Composer` parameters and adjusted its implementation. Improved code readability by reformatting the `chevronCollapsed` initialization block.
@rock3r
Copy link
Collaborator

rock3r commented Dec 10, 2024

Thanks for updating the PR.

I've looked at the change, and I am torn on it — for these reasons:

  • This makes a style creation composable when we're actively trying to make them not (see Re-evaluate whether we need standalone styling default factories to be composable #491)
  • We don't really do anything explicit to support RTL layouts — not because we don't want to, but because the Int UI design system does not, neither in the specs nor in the IDEs. This means that what the desired behaviour actually is remains largely undefined, and this would be the only component with any such logic built, which is inconsistent
  • You do not need to change Jewel to do this; users can provide their own tree styling with a CompositionLocalProvider that has the icon they prefer/need, using the existing APIs Jewel offers

As a result, I'm leaning towards not taking this in. @hamen what do you think?

@kdroidFilter
Copy link
Author

@rock3r I understand that the goal is to avoid making styles composable. My intention was simply to ensure that the icons adapt dynamically to the RTL context.

I must admit that I didn’t realize the theme was exclusively intended for use in IDEs. I thought it was also designed for building desktop applications more generally. Apologies for the inconvenience caused by this misunderstanding.

@rock3r
Copy link
Collaborator

rock3r commented Dec 10, 2024

My intention was simply to ensure that the icons adapt dynamically to the RTL context.

I understand that, but my advice would be to do it in your client code if you need to support RTL. Something like:

// At the root of your app, where you define the theme
IntUiTheme {
  val treeStyle = remember(JewelTheme.isDark) {
    // Construct the style with the right icon here based on your needs
  }

  CompositionLocalProvider(LocalLazyTreeStyle provides treeStyle) {
    // Your root composable here
  }
}

I must admit that I didn’t realize the theme was exclusively intended for use in IDEs. I thought it was also designed for building desktop applications more generally.

It is also suitable for general desktop applications, however, the design system it implements does not define RTL behaviour, and I am hesitant to implement things that don't exist in the design system nor in its Swing implementation.

@kdroidFilter
Copy link
Author

Thanks a lot !

@hamen
Copy link
Collaborator

hamen commented Dec 11, 2024

As much I appreciate external contributions, right now, I would focus on providing the core tools that mirror what the IJP and Swing are doing.
In the future, once we reach “feature parity”, we can think of iterating on this more, and expand the platform and library possibilities.
Considering your scenario, I'm glad that you can achieve your goal working “around” Jewel. This proves that the APIs are flexible enough to be customized, still providing a set of convenient defaults.
I would keep this PR closed as a reminder of future possible expansions.

@rock3r
Copy link
Collaborator

rock3r commented Dec 11, 2024

Makes sense to me. I'll close this PR then, but still want to thank you for the contribution even if it wasn't merged @kdroidFilter 🙏

@rock3r rock3r closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants