Skip to content

Hide Fork button if disabled #1601

Closed
Closed

Description

@hkdobrev

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.

Activity

  1. fregante commented on Oct 30, 2018

    @fregante
    Member

    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: #1646

  2. fregante commented on Jan 17, 2019

    @fregante
    Member

    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)

  3. added
    small
    on Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedsmall

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions