-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Fix overflowing text content in footer link #6519
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c502760
Fix overflowing text content in footer link
prajwalkulkarni 651ecba
Merge pull request #2 from prajwalkulkarni/prajwalkulkarni-patch-2
prajwalkulkarni 505ed69
Merge branch 'reactjs:main' into main
prajwalkulkarni 9233057
Add min and max width to nextlink class
prajwalkulkarni 67ebce6
Add minwidth to tailwind config
prajwalkulkarni 9eea96d
Merge branch 'reactjs:main' into main
prajwalkulkarni 8db6691
Wrap string beyond max width
prajwalkulkarni 9cd5a29
Remove title attribute from span element
prajwalkulkarni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hiding the overflow, what if we update the NextLink classes above, with this:
This will expand the hoverable area to fit the content, with a minimum width of 80, so you can read the full API name, but shorter names will still be 80w:
Screen.Recording.2024-01-09.at.12.24.22.PM.mov
Note: this will require either adding
{ minWidth: { 80: '20rem' } }
to the tailwind config, or upgrading to the latest tailwind version becausemin-w-x
was added in 3.4: https://tailwindcss.com/blog/tailwindcss-v3-4#extended-min-width-max-width-and-min-height-scalesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably update the tailwind config in this PR and do the tailwind upgrade in a separate PR.
In
tailwind.config.js
replace:With:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rickhanlonii thank you for reviewing my PR. I agree with your suggestions, but I feel there's a small caveat. If we set the width to


w-fit
on theNextLink
directly, there'd be no upper limit, meaning extra long strings would overlap the adjacent PREVIOUS card.I could think of 2 ways to solve this:
METHOD 1 - Remove explicit width
Instead we could remove the explicit width on the
NextLink
and add onlymd:w-fit
to the childdiv
(since there's no width defined on the parent wrapper element, each hoverable card would occupy the full space, i.e, 50% of the total space available) regardless of the size of the content rendered within.However, longer strings are rendered on multiple lines, so we retain the

overflow-hidden
.METHOD 2 - Set max width along with min width
We add
min-w-80
andw-fit
and along with it we also set the max-width (max-w-md
), and retain the overflow property to handle the string that is longer than what the max width can accommodate.recording.mp4
Currently, I have implemented the second approach. But I'd love to know your thoughts on this and if I should change anything further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'm not concerned about it for APIs, but for translations this could be a problem.
Can method 2 wrap at max width instead of truncating?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's a good idea. I tried adding a long string to the footer link with wrap instead of truncating it, and, we're able to show the complete string without loss of information(non-truncating). It is also in line with how long strings are rendered on the sidebar.

I've implemented

break-words
tobreak-normal
for wrapping the string. Below is a snapshot of a long string with no spaces in it.Since I'm using a class sorter extension on my VSCode, a few class names in
DocsFooter.tsx
have been re-arranged. I hope that's not an issue. But let me know if I have to revert it.