Skip to content

fix(SelectPanel): auto scroll when list overflows#1247

Merged
dgreif merged 9 commits intomainfrom
select-panel-scrolling
May 25, 2021
Merged

fix(SelectPanel): auto scroll when list overflows#1247
dgreif merged 9 commits intomainfrom
select-panel-scrolling

Conversation

@dgreif
Copy link
Copy Markdown
Member

@dgreif dgreif commented May 21, 2021

Currently, SelectPanel is allowing the list contents to overflow. This change brings back overflow: auto behavior. It also adds scrollIntoView that will trigger when active descendant changes, so that selection is always in view. I also added an example to the docs so that behavior can be tested in Vercel.

Closes https://github.com/github/primer/issues/169

Screenshots

CleanShot 2021-05-24 at 20 38 54

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented May 21, 2021

🦋 Changeset detected

Latest commit: 14e04c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented May 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/F7ydzWAWTsp2akUDDsXuoKaRoZk4
✅ Preview: https://primer-components-git-select-panel-scrolling-primer.vercel.app

@dgreif dgreif requested a review from VanAnderson May 21, 2021 22:13
Copy link
Copy Markdown
Contributor

@VanAnderson VanAnderson left a comment

Choose a reason for hiding this comment

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

Pulled it down to check it out, looks good to me 👍

@vercel vercel bot temporarily deployed to Preview May 24, 2021 16:10 Inactive
@vercel vercel bot temporarily deployed to Preview May 24, 2021 21:54 Inactive
@dgreif dgreif force-pushed the select-panel-scrolling branch from 10382e2 to 50511fc Compare May 24, 2021 22:05
@vercel vercel bot temporarily deployed to Preview May 24, 2021 22:05 Inactive
@dgreif dgreif requested a review from smockle May 24, 2021 22:37
@dgreif dgreif force-pushed the select-panel-scrolling branch from 50511fc to 7e2c169 Compare May 25, 2021 03:27
@vercel vercel bot temporarily deployed to Preview May 25, 2021 03:27 Inactive
@vercel vercel bot temporarily deployed to Preview May 25, 2021 03:42 Inactive
@vercel vercel bot temporarily deployed to Preview May 25, 2021 04:22 Inactive
@vercel vercel bot temporarily deployed to Preview May 25, 2021 16:45 Inactive
@smockle
Copy link
Copy Markdown
Member

smockle commented May 25, 2021

From @dgreif in #1247 (comment):

It also adds scrollIntoView that will trigger when active descendant changes, so that selection is always in view.

I’d initially misinterpreted “selection” in “so that selection is always in view” as referring to the selected item (rather than referring to the active descendent), and was surprised to discover single selection SelectPanel Items are not brought into view (either by moving them to the top of the list, or by scrolling to their list position) (screen recording):

2021-05-25 13 14 29

I think this is non-blocking/out-of-scope. If this affects single selection SelectPanels outside of this one Storybook, is it something we’d want to track separately?

@dgreif
Copy link
Copy Markdown
Member Author

dgreif commented May 25, 2021

@smockle great discovery! My initial implementation of scroll into view is focused on active-descendant, but we could definitely expand it to include scrolling to the first selected option in the list. I do think that's outside the scope of this change, but definitely worth discussing as another enhancement.

@vercel vercel bot temporarily deployed to Preview May 25, 2021 19:24 Inactive
@dgreif dgreif enabled auto-merge (squash) May 25, 2021 19:25
@dgreif dgreif merged commit 10df320 into main May 25, 2021
@dgreif dgreif deleted the select-panel-scrolling branch May 25, 2021 19:28
@github-actions github-actions bot mentioned this pull request May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants