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

AnimateHeight fixes for calculating the node height #2910

Merged
merged 5 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/gorgeous-fireants-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@keystonejs/app-admin-ui': patch
---

Fixed reading of `AnimateHeight` node height which because of the rounding-down nature of `scrollHeight` property value could sometimes cause scrollbar to be present in the filter popout.

Provided correct value for `AnimateHeight` css transition property's disabled state.
7 changes: 2 additions & 5 deletions packages/app-admin-ui/client/components/AnimateHeight.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class AnimateHeight extends Component {
}
calculateHeight = () => {
const { autoScroll, initialHeight, onChange } = this.props;
const height = this.node ? this.node.scrollHeight : initialHeight;
const height = this.node ? this.node.offsetHeight : initialHeight;

if (height !== this.state.height) {
this.setState({ height });
Expand Down Expand Up @@ -78,10 +78,7 @@ export default class AnimateHeight extends Component {
<div
css={{
height,
transition: isTransitioning
? 'height 220ms cubic-bezier(0.2, 0, 0, 1)'
: // idk why this is necessary but having this be null makes the transition break
'height 0s',
transition: isTransitioning ? 'height 220ms cubic-bezier(0.2, 0, 0, 1)' : 'none',
overflow,
}}
onTransitionEnd={event => {
Expand Down