Refined-github: Hide Fork button if disabled

Created on 29 Oct 2018  路  2Comments  路  Source: sindresorhus/refined-github

Private repos could have forks disabled (which is quite useful as forks of private repos are or used to be public by default). If there are no forks and creating new forks is disabled for the repo, the Fork button serves no purpose. We can hide it.

Here's a screenshot and DOM tree of a disabled fork button with 0 forks:

image

<li>
  <span class="btn btn-sm btn-with-count disabled tooltipped tooltipped-sw" aria-label="Cannot fork because forking is disabled.">
    <svg class="octicon octicon-repo-forked v-align-text-bottom" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
    Fork
  </span>
  <a href="/owner/repo/network/members" class="social-count" aria-label="0 users forked this repository">
    0
  </a>
</li>

This would also leave more space for other extensions adding this there like Sourcegraph or even some things from Refined GitHub which are on the line of the repository name.

good first issue help wanted

Most helpful comment

Related UX arguments: https://ux.stackexchange.com/q/120848/35104

It may look like noise, but if I didn't see some of the disabled buttons GitHub shows (e.g. the Edit button in commit files) I wouldn't know why that's disabled and I'd scratch my head.

Edit: also this issue is asking for the opposite of one of our features: https://github.com/sindresorhus/refined-github/issues/1646

All 2 comments

Related UX arguments: https://ux.stackexchange.com/q/120848/35104

It may look like noise, but if I didn't see some of the disabled buttons GitHub shows (e.g. the Edit button in commit files) I wouldn't know why that's disabled and I'd scratch my head.

Edit: also this issue is asking for the opposite of one of our features: https://github.com/sindresorhus/refined-github/issues/1646

If the intent is saving space, I'd suggest just hiding the text and the number if the button is disabled. This can probably be done with CSS or in 3 lines of JS (plus boilerplate)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shivapoudel picture shivapoudel  路  3Comments

juliocanares picture juliocanares  路  3Comments

yakov116 picture yakov116  路  3Comments

alexanderadam picture alexanderadam  路  3Comments

sompylasar picture sompylasar  路  3Comments