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 text wrapping on program summary and preview view. #1580

Merged
merged 9 commits into from
Aug 13, 2021

Conversation

ettengererin
Copy link
Contributor

Description

Bug addressed: Text does not wrap for long words, like copy/pasted URLs, in the application summary rows. We added custom CSS to break long words in order to wrap text.

There is a similar tailwind.css property - https://tailwindcss.com/docs/word-break#break-words. However, the tailwind css does not actually behave as expected and does not solve the issue (looks like this property is not maintained by tailwind anymore).

Adding Bion as a reviewer here to confirm that adding custom css in this way is safe and to recommend any alternatives.

Before:
image

After:
image

Checklist

  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

Issue(s)

Fixes #1567

@@ -223,7 +223,8 @@ private ContainerTag renderQuestionSummary(
Styles.P_2,
Styles.PT_4,
Styles.BORDER_B,
Styles.BORDER_GRAY_300);
Styles.BORDER_GRAY_300)
.attr("style", "word-break:break-word");
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like an important improvement!

Please use the tailwind style system whenever possible. In this case I believe you can add this constant to the class list to get the same result https://github.com/seattle-uat/civiform/blob/main/universal-application-tool-0.0.1/app/views/style/Styles.java#L2526

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We tried this tailwind property already, noted it in the PR description above:

Tailwind's break-words property does not actually behave as expected and does not solve the issue (looks like this property is not maintained by tailwind anymore). It does not properly wrap the long word text -- The URL link still overflows off the container. Seems like others experienced this problem: tailwindlabs/tailwindcss#835

Break-words from tailwind adds this css:
{overflow-wrap: break-word;}

The custom css we use adds
{word-break: break-word}

Seems like older versions of tailwind worked properly for this use case, but the newer versions are causing this issue for folks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! So sorry for not reading the description properly.

Copy link
Contributor Author

@ettengererin ettengererin Aug 13, 2021

Choose a reason for hiding this comment

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

No worries! Thanks for the review :D

@ettengererin ettengererin changed the title Css updates mobile Fix text wrapping on program summary and preview view. Aug 12, 2021
@ettengererin ettengererin merged commit d44931b into main Aug 13, 2021
@ettengererin ettengererin deleted the css-updates-mobile branch August 13, 2021 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORCA static question text is truncated
3 participants