Skip to content

Scrolling in sidebar, selected item loses focus if out of view #2957

Closed

Description

@NiklasBr

Description

When you have one item selected in the item/source list for changed files and scroll the item out of view it will lose focus and not regain its focus once returned into view. See attached screen recording below.

Version

GitHub Desktop version: 1.0.3

OS version: macOS 10.12.6 (16G29)

Steps to Reproduce

  1. Have enough changes so that Desktop will allow you to scroll.
  2. Select one item.
  3. Scroll so that the item is no longer visible.
  4. Scroll back so that the item becomes visible again.

2017-10-04 10 41 01

Expected behavior: The item should always keep its focus.

Actual behavior: Focus is lost.

Reproduces how often: 100%

Logs

n/a

Additional Information

n/a

Activity

  1. tierninho commented on Oct 4, 2017

    @tierninho
    Contributor

    Looks like we have a main and secondary color. @desktop/design can shed some light on this.

    Can reproduce with clone repo list as well.

    screen shot 2017-10-04 at 10 00 37

    screen shot 2017-10-04 at 10 00 20

  2. NiklasBr commented on Oct 4, 2017

    @NiklasBr
    ContributorAuthor

    It's not just the colour. When the item has focus, the focus can be moved up and down to the previous/next items. But when losing the focus (and it it using the secondary grey colour) focus can no longer be moved up or down using the arrow keys.

  3. shiftkey commented on Oct 4, 2017

    @shiftkey
    Member

    This is an unfortunate side-effect of using virtualized lists in many places. @niik talked a bit more about this limitation in #1669 (comment). I'll let him follow up with anything else, but maybe we do need to track this as a separate task.

  4. niik commented on Oct 4, 2017

    @niik
    Member

    Thanks for opening this @NiklasBr and nice find @shiftkey. I was scouring through issues because I knew I'd written something about this before but I couldn't find it. I definitely think this is worth tracking but as I said in that comment the fix is non-trivial.

  5. added
    bug
    on Oct 4, 2017
  6. added
    help wanted
    priority-3
    on Oct 10, 2018
  7. danny007in commented on May 3, 2021

    @danny007in
  8. NiklasBr commented on May 3, 2021

    @NiklasBr
    ContributorAuthor

    @danny007in video is available in the first comment in this issue as well as in #1669

  9. markhicken commented on Nov 11, 2022

    @markhicken
    Contributor

    According to https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement#value document.activeElement is document.body or null by default or when nothing is focused. I tested this and found that Chromium does set the default value to document.body. I thought maybe when the selected element(s) come back into existence, we could check the activeElement and refocus the selected item(s) if it is still set to the body. I have submitted the following PR for review...
    #15604

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

    bughelp wantedpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions