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

fix: Changing font causes visual distortion; more noticeable than what used to happen on the base DP #33374

Closed
wants to merge 3 commits into from

Conversation

jsartisan
Copy link
Contributor

Fixes #33331

Copy link
Contributor

coderabbitai bot commented May 13, 2024

Walkthrough

The recent updates involve optimizations in theming and UI components across several files. The useCssTokens function now consolidates dependencies in its useEffect hook, enhancing performance and maintainability. Additionally, UI adjustments in the EditorPane and widget sidebar improve responsiveness and layout consistency, using the Flex component for better style management.

Changes

File Path Change Summary
.../theming/src/hooks/src/useCssTokens.tsx Unified useEffect dependencies for typography and fontFamily.
.../Editor/IDE/EditorPane/UI/Add.tsx Changed overflowX from "scroll" to "auto" in Flex component.
.../Editor/widgetSidebar/UIEntitySidebar.tsx Replaced div with Flex component; updated imports to include Flex.

Assessment against linked issues

Objective Addressed Explanation
#33331: Visual distortion when changing fonts The consolidation of useEffect dependencies in useCssTokens.tsx might impact how font changes are handled, potentially addressing the visual distortion issue. However, without specific mention of handling or testing for the "jiggle" effect described, it's unclear if this change directly addresses the visual distortion during font changes.

The changes in the useCssTokens function could indirectly influence the rendering behavior when fonts are changed, potentially stabilizing the visual output. However, without explicit adjustments targeting the distortion or a clear test result demonstrating the effect on this specific issue, the impact remains uncertain.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Anvil POD Issue related to Anvil project Bug Something isn't working Low An issue that is neither critical nor breaks a user flow WDS team labels May 13, 2024
@jsartisan
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9059196673.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 33374.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-33374.dp.appsmith.com

@jsartisan jsartisan requested a review from KelvinOm May 13, 2024 10:18
setFontFamilyClassName(css`
${fontFamilyCss(fontFamily)}
`);
}, [fontFamily]);
}, [typography, fontFamily]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KelvinOm Moved the setting font and typography calculation under one useeffect. Hope it won't mess anything else.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This won't help, since this change won't actually change anything. To be honest, I don't see a way to fix this behavior, because if we change Font Family, browser makes reflow, browser also makes reflow, since we have to apply new font parameters that capsize returned for us. These are two different processes and there is no way to merge them even if we apply all the changes at the same time. So I don't see a way to avoid this. That's how it works.

We could make it more gentle for the user by hiding applications and showing the loader for a while. I.e. through UI/UX approach.

cc @jsartisan @ichik @ramsaptami

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to apply the changes to font-family immediately instead of waiting for the capsize calculations? Also the visual jiggle seems to be from re-calculations of inner-spacing scale happening in the second pass rather than anything typographic.

Copy link
Collaborator

@KelvinOm KelvinOm May 13, 2024

Choose a reason for hiding this comment

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

Why do we need to apply the changes to font-family immediately instead of waiting for the capsize calculations?

It won't change this. We can apply it before, immediately, or after.

Here is an example if we apply font-family with a delay(100 ms).
https://github.com/appsmithorg/appsmith/assets/11555074/8d533e35-ea8f-4bd6-9e59-b9bd283e2b38

Also the visual jiggle seems to be from re-calculations of inner-spacing scale happening in the second pass rather than anything typographic.

This is in particular due to the fact that we change the font size, line height and compensators (margins).

@jsartisan jsartisan added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label May 13, 2024
@jsartisan
Copy link
Contributor Author

Closing this PR as it does not solve the issue.

@jsartisan jsartisan closed this May 14, 2024
@jsartisan jsartisan reopened this May 14, 2024
@github-actions github-actions bot removed the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label May 14, 2024
@jsartisan jsartisan closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil POD Issue related to Anvil project Bug Something isn't working Low An issue that is neither critical nor breaks a user flow WDS team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Changing font causes visual distortion; more noticeable than what used to happen on the base DP
3 participants