Skip to content

Commit d88009f

Browse files
committed
fix(Overlay): correct top for tab
1 parent d8628ea commit d88009f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/overlay/utils/position.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ export default class Position {
182182
const { right, bottom } = this._getViewportOffset(pinElement, align);
183183
firstPositionResult = {
184184
left: right < 0 ? left + right : left,
185-
top: bottom < 0 ? top + bottom : top,
185+
top,
186+
// top: bottom < 0 ? top + bottom : top,
186187
};
187188
} else {
188189
firstPositionResult = { left, top };

test/overlay/index-spec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ describe('Overlay', () => {
361361

362362
simulateEvent.simulate(btn, 'click');
363363
assert(document.body.style.overflowY === 'hidden');
364-
assert(document.body.style.paddingRight === `${scrollbarWidth}px`);
364+
// paddingRight 有没有值取决于当前浏览器环境是否有滚动条(mac可以设置默认有,或默认没有)
365+
// assert(document.body.style.paddingRight === `${scrollbarWidth}px`);
365366

366367
simulateEvent.simulate(btn, 'click');
367368
yield delay(500);
@@ -585,7 +586,7 @@ describe('Overlay', () => {
585586
container.remove();
586587
});
587588

588-
it('fix bottom & left overflow', () => {
589+
it('fix left overflow', () => {
589590
const container = document.createElement('div');
590591

591592
function Demo(props) {
@@ -616,7 +617,7 @@ describe('Overlay', () => {
616617
document.querySelector('.next-overlay-inner').style.left ===
617618
`${parseFloat(window.getComputedStyle(document.body).width) - 200 - 1}px` // Reason to subtract 1, see: Overly._isInViewport
618619
);
619-
assert(document.querySelector('.next-overlay-inner').style.top === '0px');
620+
// assert(document.querySelector('.next-overlay-inner').style.top === '0px');
620621
container.remove();
621622
document.querySelector('.next-overlay-wrapper').remove();
622623
});

0 commit comments

Comments
 (0)