Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tlouisse authored Aug 28, 2024
1 parent bb3c7f3 commit 7c8d8f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .changeset/avoid-growing-margin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@lion/ui': patch
---

fix(2323): avoid growing margin when using overlays with tooltips
fix: [overlays] avoid growing margin when using `preventsScroll: false`
2 changes: 1 addition & 1 deletion packages/ui/components/overlays/src/OverlayController.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ export class OverlayController extends EventTarget {
* @protected
*/
_keepBodySize({ phase }) {
if (this.placementMode !== 'global') {
if (!this.preventsScroll) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1771,13 +1771,18 @@ describe('OverlayController', () => {
*/
const overlayControllerLocal = new OverlayController({
...withLocalTestConfig(),
preventsScroll: false,
});

it('should not run with local placement', async () => {
await overlayControllerLocal.show();

expect(overlayControllerLocal.__bodyMarginRightInline).to.equal(undefined);
expect(overlayControllerLocal.__bodyMarginRight).to.equal(undefined);

overlayControllerLocal.updateConfig({ preventsScroll: true });
expect(overlayControllerLocal.__bodyMarginRightInline).to.not.equal(undefined);
expect(overlayControllerLocal.__bodyMarginRight).to.not.equal(undefined);
});
});
});

0 comments on commit 7c8d8f5

Please sign in to comment.