Skip to content

more-dropdown compatibility with "Repository refresh" design #3215

Closed

Description

@fregante

more-dropdown is kind of a problem now since the new design has an automatic "overflow" hamburger menu:

The obvious solution is to add all those elements to the navigation and let them naturally flow into the overflow, but that's noisy.

Until now we added items to the dropdown without much trouble, since it was "out of the way", but this change forces us to reconsider it.

Originally posted by @fregante in #3081 (comment)

cc @sindresorhus

Activity

  1. aminya commented on Jun 11, 2020

    @aminya
  2. yakov116 commented on Jun 11, 2020

    @yakov116
    Member
  3. fregante commented on Jun 18, 2020

    @fregante
    MemberAuthor

    Is it possible to have the dropdown on the bar, but when it "overflows" its contents end up in the native dropdown?

    E.g.

    Wide viewport
     _________________________________________________________________________
    |                                                                         |
    | Code - Issues - Pull requests - Actions - [ More ▼ ]                    |
    |                                            Commits                      |
    |                                            Branches                     |
    |                                            Compare                      |
    |_________________________________________________________________________|
    

    Becomes

    Small viewport
     ___________________________________________
    |                                           |
    | Code - Issues - Pull requests - [ ... ]   |
    |                                 Actions   |
    |                                 Commits   |
    |                                 Branches  |
    |                                 Compare   |
    |___________________________________________|
    
  4. kidonng commented on Jun 19, 2020

    @kidonng
    Member

    Is it possible to have the dropdown on the bar, but when it "overflows" its contents end up in the native dropdown?

    Isn't this what we have in #3186?

  5. notlmn commented on Jun 19, 2020

    @notlmn
    Contributor

    We can start by adding a max-width to .js-repo-nav, but that still keeps the dropdown trigger to the right.

    There's some layout issues using position: relative on nav, and there's also figuring out max-width in the first place.

    Just some thoughts.

  6. fregante commented on Jun 19, 2020

    @fregante
    MemberAuthor

    I like the max-width solution, but it’s a little risky because other extensions add tabs too.

    @kidonng yes, but that’s just 1 item out, 1 item in. I’m talking about 1 item out (the More dropdown) and 5 items in (once it overflows): could that work?

  7. kidonng commented on Jun 19, 2020

    @kidonng
    Member

    I underestimated the problem. Just navigated through GitHub's code:

    image

    So insert all the .js-responsive-underlinenav-item before the listener is added? Impossible. Hook window.addEventlistner? Dirty. Make another listener? Tedious and error-prone. Well, I don't really have more ideas.

  8. fregante commented on Jun 19, 2020

    @fregante
    MemberAuthor

    GitHub’s selectors are "live", so new elements are automatically picked up.

    I looked into it just now and it looks somewhat possible:

    • The link on the horizontal nav is a different DOM element from the one in the native dropdown
       nav
       	a[data-tab-item="issues-tab"]
      
       	.js-responsive-underlinenav-overflow
       		li[data-tab-item="issues-tab"]
    • These 2 links are connected by the data-tab-item attribute
      • when [data-tab-item="insights-tab"] is hidden from the nav, the other element in the dropdown with the same attribute is shown
    • items are removed from the nav regardless of whether they have a matching item in the dropdown (I think as long as they have the js-responsive-underlinenav-item class)

    Given this, I think that this could be a solution:

    nav
    	a[data-tab-item="issues-tab"]
    	.more-dropdown.js-responsive-underlinenav-item
    		a[data-tab-item="dependencies"]
    		a[data-tab-item="commits"]
    
    	.js-responsive-underlinenav-overflow
    		li[data-tab-item="issues-tab"]
    		li[data-tab-item="dependencies"]
    		li[data-tab-item="commits"]
  9. kyleknighted commented on Jun 23, 2020

    @kyleknighted
  10. added
    Please! ♥︎
    on Jul 2, 2020
  11. self-assigned this
    on Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Please! ♥︎acceptedenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions