Skip to content

Commit

Permalink
Merge pull request #9860 from Joe-mcgee/feature/overflow-popover-scro…
Browse files Browse the repository at this point in the history
…lling

[FIX] Popover divs don't scroll if they overflow the viewport
  • Loading branch information
rodrigok committed Mar 26, 2018
2 parents 5cafdc0 + 8fdb4d2 commit 0ed0cfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
}
}

&__content-scroll {

.rc-popover__item {
display:block;
}
}

&__title {
flex: 1;

Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-ui/client/views/app/popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ Template.popover.onRendered(function() {
});
}

const realTop = Number(popoverContent.style.top.replace('px', ''));
if (realTop + popoverContent.offsetHeight > window.innerHeight) {
popoverContent.style.overflow = 'scroll';
popoverContent.style.bottom = 0;
popoverContent.className = 'rc-popover__content rc-popover__content-scroll';
}

if (activeElement) {
$(activeElement).addClass('active');
}
Expand Down

0 comments on commit 0ed0cfb

Please sign in to comment.