Skip to content

Improve wrapping of repo header buttons on smaller screens - #5622

Closed
cheap-glitch wants to merge 6 commits into
mainfrom
wrap-header-buttons
Closed

cheap-glitch wants to merge 6 commits into
mainfrom
wrap-header-buttons

Conversation

@cheap-glitch

@cheap-glitch cheap-glitch commented May 6, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #5398

Test URLs

refined-github/refined-github
fregante/webext-dynamic-content-scripts

Screenshot

Before 👎

before

After 👍

after

@cheap-glitch cheap-glitch left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: as shown in the video above, this PR also restores the buttons on mobile — where they're normally hidden by GitHub.

Not sure if this is a welcomed change, so I don't mind dropping it.

@fregante

fregante commented May 6, 2022

Copy link
Copy Markdown
Member

We don't need to also deal with the buttons on mobile. They're hidden by default there except some on the homepage, right?

I'd rather just see some 4-line GitHub bug CSS. I guess my suggested CSS snippet only lacks a gap line?

@cheap-glitch cheap-glitch left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I've reduced the CSS to the minimum amount necessary. Unfortunately it still requires a bit more than 4 lines.

Comment thread source/refined-github.css Outdated
}

/* Improve wrapping of repo header buttons on smaller screens #5398 */
@media (min-width: 768px) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need the media query to avoid showing all the buttons on mobile.

Comment thread source/refined-github.css Outdated
Comment on lines +183 to +185
#repository-container-header > :first-child > :first-child {
flex-shrink: 0 !important;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that rather having the buttons wrapper shrink more, it's better to have the title not shrink at all. It's guaranteed to always avoid weird layout breaks like these:

@fregante fregante May 7, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We also have to consider long repository names. flex-shrink: 3 or higher gives priority to the title without causing the opposite problem.

not shrink at all

That's the exact reason why this bug exist. This PR causes the opposite problem (buttons are off screen):

Screen Shot 2

We have to allow wrapping, this is too much code to achieve that the wrong way.

Comment thread source/refined-github.css Outdated
Comment on lines +195 to +197
.pagehead-actions li {
margin-right: 0 !important;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needed because this is replaced by gap on the parent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure why but I'm seeing this on Chrome

Screen Shot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's likely because the display: flex didn't apply, the selector just needs to be made more specific.

@cheap-glitch

Copy link
Copy Markdown
Contributor Author

Changed to the "shrink more strategy" and moved the fix to github-bugs.css. Tested on Chromium too:

image

@cheap-glitch

cheap-glitch commented May 8, 2022 •

Copy link
Copy Markdown
Contributor Author

Closing in favor of #5623

@cheap-glitch
cheap-glitch deleted the wrap-header-buttons branch May 8, 2022 08:21
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

2 participants