Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilteredActionList inherits height and maxHeight from its parent #1500

Merged
merged 5 commits into from
Oct 6, 2021

Conversation

jfuchs
Copy link
Contributor

@jfuchs jfuchs commented Oct 5, 2021

This PR updates FilteredActionList so that its root HTML element is styled with height: inherit; max-height: inherit. This prevents a bug where FilteredActionList sizes itself larger than the Overlay that contains it, preventing scrolling.

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

Screenshots

before:

CleanShot.2021-09-30.at.10.11.37.mp4

after:

CleanShot.2021-10-05.at.12.09.13.mp4

Merge checklist

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

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@jfuchs jfuchs requested review from smockle and a team October 5, 2021 19:11
@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2021

🦋 Changeset detected

Latest commit: fe18735

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

@jfuchs jfuchs requested review from colebemis and removed request for smockle October 5, 2021 19:13
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2021

size-limit report 📦

Path Size
dist/browser.esm.js 55.41 KB (0%)
dist/browser.umd.js 55.73 KB (0%)

@jfuchs
Copy link
Contributor Author

jfuchs commented Oct 5, 2021

@dusave was kind enough to verify that this fixes the bug in new projects

@jfuchs
Copy link
Contributor Author

jfuchs commented Oct 5, 2021

After speaking with @vdepizzol, I wanted to offer a tweak on this: Remove the height/maxHeight styling from FilteredActionList, but then extend FilteredActionList to accept styles via sx, then pass the height/maxHeight from SelectPanel's render of FilteredActionList:

<FilteredActionList
  // other stuff
  sx={{height: 'inherit', maxHeight: 'inherit'}}
/>

edit: gonna do this

<FilteredActionList
filterValue={filterValue}
onFilterChange={onFilterChange}
{...listProps}
Copy link
Member

@smockle smockle Oct 6, 2021

Choose a reason for hiding this comment

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

Since the FilteredActionListProps interface now extends SxProp, someone may pass a listProps that includes sx, right? If they do, line 166 below will overwrite the sx value they pass. Would we want to merge (i.e. sx={{ ...listProps.sx, height: 'inherit', maxHeight: 'inherit' }})?

Copy link
Contributor Author

@jfuchs jfuchs Oct 6, 2021

Choose a reason for hiding this comment

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

I might have this wrong, but I think we're safe as is because the SelectPanelProps type doesn't include an sx prop, and listProps is just a "rest" destructuring of the SelectPanel props?

Copy link
Member

@smockle smockle Oct 6, 2021

Choose a reason for hiding this comment

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

@jfuchs I might be missing something, but it seems that SelectPanelProps does contain sx, via Omit<FilteredActionListProps, 'selectionVariant'>:

export type SelectPanelProps = SelectPanelBaseProps &
Omit<FilteredActionListProps, 'selectionVariant'> &

Screen shot showing the 'sx' property of 'SelectPanelProps'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, sorry — you're right, it is in there. Updated!

@jfuchs jfuchs merged commit 8c3531a into main Oct 6, 2021
@jfuchs jfuchs deleted the jfuchs/selectpanel branch October 6, 2021 22:00
@primer-css primer-css mentioned this pull request Oct 6, 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.

5 participants