Skip to content

Commit ed258d0

Browse files
committed
make commit-statuses popup can be shown correctly.
1 parent a462fca commit ed258d0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

web_src/js/features/repo-legacy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,13 @@ export async function initRepository() {
267267

268268
// Commit statuses
269269
$('.commit-statuses-trigger').each(function () {
270+
const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
271+
const popupPosition = positionRight ? 'right center' : 'left center';
270272
$(this)
271273
.popup({
272274
on: 'click',
273-
position: ($('.repository.file.list').length > 0 ? 'right center' : 'left center'),
275+
lastResort: popupPosition, // prevent error message "Popup does not fit within the boundaries of the viewport"
276+
position: popupPosition,
274277
});
275278
});
276279

web_src/less/_repository.less

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
.repository {
2-
.commit-statuses .list > .item {
3-
line-height: 2;
2+
.popup.commit-statuses {
3+
// we had better limit the max size of the popup, and add scroll bars if the content size is too large.
4+
// otherwise some part of the popup will be hidden by viewport boundary
5+
max-height: 45vh;
6+
max-width: 60vw;
7+
overflow: auto;
8+
padding: 0;
9+
10+
.list {
11+
padding: .8em; // to make the scrollbar align to the border, we move the padding from outer `.popup` to this inside `.list`
12+
13+
> .item {
14+
line-height: 2;
15+
}
16+
}
417
}
518

619
.repo-header {

0 commit comments

Comments
 (0)