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

SvgChevronRight icon in SubRowExpander component rotates 180 degrees instead of 90 on expansion #1750

Closed
DenisMicha opened this issue Dec 21, 2023 · 6 comments · Fixed by #1796
Assignees
Labels
bug Something isn't working

Comments

@DenisMicha
Copy link

SvgChevronRight icon in SubRowExpander component rotates 180 degrees instead of 90 on expansion.

Actual behavior

Chevron points to the left side when sub rows expanded (rotates 180deg).

Expected behavior

Chevron points down when sub rows expanded (rotates 90deg).

This behavior happens because both SvgChevronRight component and its wrapping IconButton component include 90deg rotation on expansion, therefore total rotation becomes 180deg. The "transform" property which causes rotation should be removed from SvgChevronRight component styles.

@DenisMicha DenisMicha added the bug Something isn't working label Dec 21, 2023
@mayank99
Copy link
Contributor

Could you provide a repro by forking this template? It works fine here: https://itwin.github.io/iTwinUI/react/?story=table--expandable-subrows&theme=dark

@mayank99 mayank99 added the needs more info This issue is waiting on more info from author label Dec 21, 2023
@DenisMicha
Copy link
Author

DenisMicha commented Dec 22, 2023

Hi @mayank99,

Here is the repro code: https://stackblitz.com/edit/github-cph1jx?file=src%2FApp.tsx.

Apparently adding the "subComponent" property to the Table component adds the additional rotation. It is a bit confusing that adding/removing this property impacts chevron rotation, so I think SvgChevronRight style is good but the rotation as a side effect of "subComponent" property should be removed.

Also, if it is okay, it would be good to make the chevron rotation smooth.

@r100-stack
Copy link
Member

I believe the subComponent is not intended to be used when any of the rows have subRows.

But yes, the side effect you mentioned in #1749 seems to be duplicate because there already is CSS that applies a transform on .iui-button-icon:

.iui-table-row-expander > .iui-button-icon {
transform: rotate(90deg);
}

@mayank99 mayank99 removed the needs more info This issue is waiting on more info from author label Dec 22, 2023
@mayank99
Copy link
Contributor

mayank99 commented Dec 26, 2023

@DenisMicha Could you share why you're passing subComponent while also using subRows? These are somewhat mutually-exclusive features that are not designed to work together.

In your sandbox, subComponent={() => undefined} does more than just combine the rotations (from subComponent and subRows). It also changes some alignment and applies border around the entire row and its subcomponent (which is undefined in this case).

without subComponent with subComponent
image image

@DenisMicha
Copy link
Author

@mayank99 I am not sure, but we probably started passing subComponent exactly because of the alignment. Is there a reason why the alignment is different? Could the alignment with only subRows be changed to be similar to subComponent alignment?

@mayank99
Copy link
Contributor

The alignment has been fixed in 3.3.1, so you can get rid of subComponent.

In the future, we might add some documentation or a runtime warning if more users attempt to use subComponent and subRows together.

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 a pull request may close this issue.

3 participants