Skip to content

Commit 2b2eb5d

Browse files
authored
make commit-statuses popup can be shown correctly. (#17447)
Close #17443 Maybe we do not need to backport this PR, the bug doesn't break daily usage. After the fix, the commit statuses popup can show a lot of lines with scroll bars: ![image](https://user-images.githubusercontent.com/2114189/139026160-f01b484c-6207-494a-a190-a6dd184ceb2b.png)
1 parent 4f00de1 commit 2b2eb5d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

web_src/js/features/repo-legacy.js

+4-1
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

+15-2
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)