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

fix(expandable-tile): set tile height using resize observer #1738

Merged
merged 2 commits into from
Jun 2, 2023

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented May 28, 2023

Fixes #1730

Currently, the ExpandableTile does not dynamically set the height of the above-the-fold content. In cases where the content is dynamic (a lot of text), this can result in clipped content.

This PR aims to fix this problem by using the Resize Observer to set the height of the tile, and adjust it if the height changes. It implements the approach of the upstream React library almost verbatim.

In terms of behavior, this should not be a breaking change since you can still specify a custom tile height on the "above" and "below" slots.

Changes

  • Fix ExpandableTile to use Resize Observer to set the tile max height
  • Rework the docs to promote not setting a height; add an example for customizing the tile heights

Example

In the following example, I am clicking a button that doubles the text in the above-the-fold tile. Note how the tile height adjusts itself dynamically.

expandable-tile-double.mov

Issue #1730 (before)

expandable-tile-ex-before.mov

Issue #1730 (after)

expandable-tile-ex-after.mov

Copy link
Collaborator

@theetrain theetrain left a comment

Choose a reason for hiding this comment

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

This works well! 👍

@theetrain theetrain merged commit a369962 into master Jun 2, 2023
2 checks passed
@theetrain theetrain deleted the fix-expandable-tile branch June 2, 2023 17:08
@metonym
Copy link
Collaborator Author

metonym commented Jun 2, 2023

Thanks for reviewing! 🙏

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.

[ExpandableTile] height should accommodate large above-the-fold content
2 participants