Skip to content

Fix GitHub bug: Avoid excessive repo title wrap - #5623

Merged
fregante merged 5 commits into
mainfrom
wrap-repo-actions
May 8, 2022
Merged

fregante merged 5 commits into
mainfrom
wrap-repo-actions

Conversation

@fregante

@fregante fregante commented May 7, 2022 •

Copy link
Copy Markdown
Member

Fixes #5398
Replaces #5622

Test URLs

https://github.com/refined-github/refined-github
https://github.com/fregante/webext-dynamic-content-scripts

Before

Screen Shot 9

After

Screen Shot 10


Unfortunately the parent’s flexbox is still pretty bad at sharing the space, but it's unlikely that we can do much about it: Once flexbox has to wrap something, it will drop space from both: 1/4 from the title and 3/4 from the actions. This can cause both sides to wrap internally even even the sum of the available space is available from at least one more piece from either side:

Screen Shot 7

@fregante fregante changed the title Avoid excessive repo title wrap by deprioritizing the repo header act… Fix GitHub bug: Avoid excessive repo title wrap May 7, 2022
@fregante

fregante commented May 7, 2022 •

Copy link
Copy Markdown
Member Author

inline (first commit)

Screen Shot 4

inline-flex (second commit)

Using flex box on the actions allows us to align them to the right after they wrap:

Screen Shot 5

@fregante
fregante requested a review from cheap-glitch May 7, 2022 03:49
@fregante
fregante marked this pull request as ready for review May 7, 2022 03:49
Comment thread source/features/github-bugs.css Outdated
justify-content: flex-end;
}

:root .pagehead-actions > li {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On non-personal repos there's an empty element (Edit pins) that starts taking up space once we add margin-bottom

Comment thread source/features/github-bugs.css Resolved
Comment thread source/features/github-bugs.css Resolved
@cheap-glitch

Copy link
Copy Markdown
Contributor

Side note: we could probably wrap ci-link with the second part of the repo title to avoid this:

@fregante

fregante commented May 7, 2022 •

Copy link
Copy Markdown
Member Author

we could probably wrap ci-link with the second part of the repo title to avoid this:

It has to wrap. Think of the icon as a word of the repo name. Either the icon or the repo name has to wrap.

What happens if it doesn't wrap? Should the text wrap and the icon stays on the right (middle)? Then there will be additional space between the name and the icon and it won't look better.

If neither wraps, we're back to square one.

The ideal behavior would be to have it wrap together with a word, like a proper typesetter would do to avoid the orphan, but:

  • impossible
  • it would increase the "seemingly-available space" even more

@cheap-glitch

This comment was marked as off-topic.

@fregante

fregante commented May 8, 2022

Copy link
Copy Markdown
Member Author

Edit: it works, but the dropdown button is not clickable due to being inside the link 🥲

Yep, that's why it's "impossible". The alternative is to move the last word out of the link, wrap it with the icon, link it again (just the last word), but then we'd have two separate links for the same repo name. Still not a good compromise.

flex-shrink: 3 !important;
display: inline-flex !important;
flex-wrap: wrap;
justify-content: flex-end;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
justify-content: flex-end;
justify-content: flex-end;
margin: 0 -8px -8px 0; /* Offset the unwanted padding caused by the margins on children elements */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What for? I don't see any unwanted padding

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah I'll try it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This directly overrides the margin we set above, CSS should ideally never undo itself.

I'll use margin: 8px 8px 0 0; to replace the existing value

@fregante
fregante merged commit 9cc1b23 into main May 8, 2022
@fregante
fregante deleted the wrap-repo-actions branch May 8, 2022 10:27
@yakov116

yakov116 commented May 8, 2022

Copy link
Copy Markdown
Member

Great Team work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Fix repo title wrapping on small screens

3 participants