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

Modal's "transform: translate" to center it makes text blurry #1551

Open
AAugustBentley opened this issue Sep 8, 2023 · 21 comments · Fixed by #1693 or #1795
Open

Modal's "transform: translate" to center it makes text blurry #1551

AAugustBentley opened this issue Sep 8, 2023 · 21 comments · Fixed by #1693 or #1795
Assignees
Labels
bug Something isn't working

Comments

@AAugustBentley
Copy link

AAugustBentley commented Sep 8, 2023

We have a modal that has a few tabs with different data shown in a table.
However, text in a table becomes very blurry when adding a table height (so that it would not overflow and we would have a scrollbar to look through all entries in the table).
image

Even without height, it does not look clear enough.
image

I tried adding backface-visibility: hidden;, -webkit-font-smoothing: subpixel-antialiased;, overwritting transform with transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px)) and other things but nothing worked. I think this happens because with a lot of elements put in each other, those "transform translate" decimal sizes become worse than if they were on top level (for example, tabs' text looks fine).

The solution for now I came up with for now is removing transform and changing it to display: flex and then centering with justify-content and align-items in the modal's wrapper. The only problem I noticed with that is that if a modal has buttons with navigation when closing the current and loading another modal, there is a noticeable blinking.

Could anyone check this?

@AAugustBentley AAugustBentley added the bug Something isn't working label Sep 8, 2023
@mayank99
Copy link
Contributor

mayank99 commented Sep 8, 2023

hey @AAugustBentley, thanks for the issue. It is very hard to tell what part is blurred just from the screenshots and we don't have the ability to debug either. Could you try to recreate this scenario in a sandbox or at least share a deployed url? And could you also share information about your environment (OS, browser, screen resolution, zoom level)?

@mayank99 mayank99 added the needs more info This issue is waiting on more info from author label Sep 12, 2023
@HaveSpacesuit
Copy link
Contributor

@mayank99 We experience this issue with modals that have tables in them in our app. Here is a code sandbox that can reproduce the issue. https://codesandbox.io/s/blurry-text-dialog-qf94c5?file=/src/App.tsx

It is more clear if you view it outside the code sandbox editor (https://qf94c5.csb.app/).

Blurry dialog

@AAugustBentley
Copy link
Author

So it wasn't only for us. I failed to reproduce it at first, seems like adding height to modal prevents blurryness but then it is harder to keep content inside the modal without overflowing. https://codesandbox.io/s/itwinui-modal-blur-lldrsj
image

P.S. it is easier to see blurryness outside the editor

@mayank99
Copy link
Contributor

Thanks for the repro. I was able to reproduce it in Chrome on Windows 11 (top) but not macOS 14 (bottom), even though they are on the same hardware and have the same CSS transform value.

image

Interestingly, rounding out the fractional transform value makes it unblurred, so I think that would be the simplest solution. I'm also looking into positioning it with flexbox or grid. One constraint there is that we want the dialog to be slightly above the vertical center rather than being in the dead center. I'll go with the rounding solution if this doesn't work out.

@mayank99 mayank99 self-assigned this Nov 14, 2023
@mayank99 mayank99 removed the needs more info This issue is waiting on more info from author label Nov 14, 2023
@mayank99 mayank99 linked a pull request Nov 14, 2023 that will close this issue
@mayank99
Copy link
Contributor

Should be fixed in 3.0.6

@mattl-bentley
Copy link
Contributor

@mayank99 I'm in the process of updating to 2.12.17 and noticed this issue. Can this fix be backported to 2x?

@mattl-bentley
Copy link
Contributor

@mayank99 any updates on fixing this in 2x?

@mayank99
Copy link
Contributor

mayank99 commented Dec 7, 2023

this has been backported to 2.12.18

@mattl-bentley
Copy link
Contributor

thanks @mayank99

@HaveSpacesuit
Copy link
Contributor

@mayank99 It looks like this is still an issue when there is a table inside an expandable block. Not sure how common the use case is, but maybe it means there are other situations when it is a problem?

image

@mayank99
Copy link
Contributor

mayank99 commented Mar 5, 2024

It looks like this is still an issue when there is a table inside an expandable block. Not sure how common the use case is, but maybe it means there are other situations when it is a problem?

Are you able to create a repro?

@HaveSpacesuit
Copy link
Contributor

It took a while, but I found that if you change height: 100dvh to height: 100% in the demo app, it causes blurriness. Unfortunately, trying to use height: 100dvh in my app doesn't seem to make any difference, so there are probably other things going on. (But this component is only used for QA anyway, so not an immediate issue for customers.)

https://stackblitz.com/edit/github-fsmjja

Blurry table in expander

@mayank99
Copy link
Contributor

I found that if you change height: 100dvh to height: 100% in the demo app, it causes blurriness

stackblitz.com/edit/github-fsmjja

Thanks for the repro. I'll reopen this issue as it was confirmed on Windows.

Some other interesting observations:

  • I found that using dvh actually can sometimes make it less blurry?

    Recording
    Screen.Recording.2024-03-12.at.9.55.54.AM.mov
  • @Ben-Pusey-Bentley found that removing the ExpandableBlock can sometimes fix the blurring.

    Recording
    Recording.2024-03-12.095301.mp4

But this component is only used for QA anyway, so not an immediate issue for customers.

This is good to know. I guess we'll keep an eye out for any similar future reports, and prioritize based on that. For now we can leave it be.

@mayank99 mayank99 reopened this Mar 12, 2024
@AAugustBentley
Copy link
Author

AAugustBentley commented Mar 19, 2024

Started working on another modal and I still see problems with blurriness in tables, this time it's the icon button (in a sticky column) and information panel
image

Pulled the newest itwinui-react version (v3.6.0) just to check if it changes anything. This is going to be released for users, so maybe this item could be prioritized, please?

@HaveSpacesuit
Copy link
Contributor

I also noticed a table in an info panel was blurry.

@AAugustBentley
Copy link
Author

Started working on another modal and I still see problems with blurriness in tables, this time it's the icon button (in a sticky column) and information panel image

Pulled the newest itwinui-react version (v3.6.0) just to check if it changes anything. This is going to be released for users, so maybe this item could be prioritized, please?

Reproduced code: https://stackblitz.com/edit/github-acfvki?file=src%2FApp.tsx

@mayank99

This comment was marked as outdated.

@mayank99
Copy link
Contributor

Something common to Dialog/InformationPanel/ExpandableBlock is that they all use transform: translate. My guess is that when two or more such instances are combined, it can cause blurring.

Our team was able to confirm it in some situations (the repro links definitely help). But ultimately this is just a (minor) bug in Chrome on Windows. We can't address the root cause, only work around it.

So there isn't much we can do right now, but in the future we'll keep this in mind when we refactor our Dialog (and maybe other components) to use flex layout. This issue can remain open for now.

@AAugustBentley
Copy link
Author

AAugustBentley commented Mar 21, 2024

We made a workaround to not use transform from our side to fix blurriness issue, if anyone is interested. The only issue with this solution would be that the modal is going to be in the middle.

add css on modal wrapper _iui3-dialog-wrapper
image

then on the modal itself (iui-dialog)
image

@HaveSpacesuit
Copy link
Contributor

Here is another example of blurry text on a tile inside a draggable dialog.
https://stackblitz.com/edit/github-rfuo7n?file=src%2FApp.tsx

image

@MrHBS
Copy link

MrHBS commented May 24, 2024

Does adding will-change: transform; help?

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
5 participants