Skip to content

Commit 01b7d60

Browse files
EldarMuhamethanovactions-user
authored andcommitted
fix(Popover): fix hide popover when reference hidden (#8700)
* fix(Popover): fix hide popover when reference hidden * test(Popover): add test * fix(ImageBase): change hide image logic * test: fix tests
1 parent 4587857 commit 01b7d60

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

packages/vkui/src/components/ImageBase/ImageBase.module.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343

4444
.img {
4545
display: block;
46-
visibility: hidden;
4746
inline-size: 100%;
4847
block-size: 100%;
4948
border: 0;
@@ -89,8 +88,8 @@
8988
);
9089
}
9190

92-
.loaded .img {
93-
visibility: visible;
91+
.host:not(.loaded) .img {
92+
visibility: hidden;
9493
}
9594

9695
.fallback {

packages/vkui/src/lib/floating/functions.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,28 @@ describe('floating/functions', () => {
8484
left: 0,
8585
});
8686
});
87+
88+
it('should return style with visibility: hidden, when reference hidden', () => {
89+
expect(
90+
convertFloatingDataToReactCSSProperties({
91+
strategy: 'absolute',
92+
x: 0,
93+
y: 0,
94+
middlewareData: {
95+
hide: {
96+
referenceHidden: true,
97+
},
98+
},
99+
}),
100+
).toEqual({
101+
position: 'absolute',
102+
top: 0,
103+
right: 'auto',
104+
bottom: 'auto',
105+
left: 0,
106+
width: 'max-content',
107+
visibility: 'hidden',
108+
});
109+
});
87110
});
88111
});

0 commit comments

Comments
 (0)