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

[Toolpad Editor] Fix : text component alignment rendering #2587

Merged
merged 8 commits into from
Sep 4, 2023

Conversation

rohanprasadofficial
Copy link
Contributor

Fixes #2071

This PR targets to fix the alignment issues when rendering the text component on the canvas. It was also showing the correct alignment state on the left panel.

The typography was taking full width not allowing the text to align to correct position.
Made the typography alignment as 'auto' to fix the issue.

After Fix

text.alignment.fix.mov
  • I've read and followed the contributing guide on how to create great pull requests.
  • I've updated the relevant documentation for any new or updated feature
  • I've linked relevant GitHub issue with "Closes #"
  • I've added a visual demonstration under the form of a screenshot or video

@rohanprasadofficial rohanprasadofficial marked this pull request as ready for review August 30, 2023 14:21
Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

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

Simple and effective, thank you!
Suggesting a possible improvement just in case it also works.

packages/toolpad-components/src/Text.tsx Outdated Show resolved Hide resolved
@Janpot
Copy link
Member

Janpot commented Aug 30, 2023

I'd think I'd like to add some visual regression tests before we merge this with

  1. text that overflows the width
  2. a single word that overflows the width

@rohanprasadofficial
Copy link
Contributor Author

I'd think I'd like to add some visual regression tests before we merge this with

  1. text that overflows the width
  2. a single word that overflows the width

@Janpot is this configured internally or i can do that ? If yes can you point me to any docs for same ?

@Janpot
Copy link
Member

Janpot commented Aug 31, 2023

I'm adding a test here. Once that one is merged we can add some tests for alignment as well.

I don't know if you've noticed, but this PR causes a visual regression test to fail around resizing columns: https://app.argos-ci.com/mui/mui-toolpad/builds/668/56635162

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

@apedroferreira
Copy link
Member

apedroferreira commented Sep 1, 2023

This causes a regression in https://app.argos-ci.com/mui/mui-toolpad/builds/668/56635162

Oh, in the test showing grid while resizing elements I had the wrong assumption that the edges of the text are the same as the edges of the container that are used to resize columns.
So the test will probably work if instead of Text components that page uses components that take up the full width of their container, such as full-width text fields.
Let me know if you'd like me to add this fix in this PR, as it's an issue that I introduced.

@apedroferreira
Copy link
Member

apedroferreira commented Sep 1, 2023

This causes a regression in https://app.argos-ci.com/mui/mui-toolpad/builds/668/56635162

Oh, in the test showing grid while resizing elements I had the wrong assumption that the edges of the text are the same as the edges of the container that are used to resize columns. So the test will probably work if instead of Text components that page uses components that take up the full width of their container, such as full-width text fields. Let me know if you'd like me to add this fix in this PR, as it's an issue that I introduced.

I've added a PR for handle the visual test regression here: #2610

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Sep 2, 2023
@Janpot
Copy link
Member

Janpot commented Sep 4, 2023

Can you just add a short text for each alignment in the visual regression tests? You can start them with

yarn run toolpad dev test/visual/components/fixture --dev

You can just drag three more text components to the bottom of this page and configure their alignment. The screenshot will update accordingly.

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

@Janpot Janpot merged commit 1eb90b1 into mui:master Sep 4, 2023
1 check passed
@Janpot
Copy link
Member

Janpot commented Sep 5, 2023

@rohanprasadofficial This PR broke the text loading indicator: #2631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizontal alignment not working for text component
4 participants