Skip to content

Commit c10df52

Browse files
authored
fix(modal): backdrop animation when backdropBreakpoint is 1 (#25430)
Resolves #25402
1 parent 7b105a3 commit c10df52

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { getBackdropValueForSheet } from './utils';
2+
3+
describe('getBackdropValueForSheet()', () => {
4+
it('should return a valid integer when backdropBreakpoint is 1', () => {
5+
/**
6+
* Issue: https://github.com/ionic-team/ionic-framework/issues/25402
7+
*/
8+
const backdropBreakpoint = 1;
9+
expect(getBackdropValueForSheet(1, backdropBreakpoint)).toBe(0);
10+
});
11+
});

core/src/components/modal/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
2323
*
2424
* This is simplified from:
2525
* m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
26+
*
27+
* If the backdropBreakpoint is 1, we return 0 as the
28+
* backdrop is completely hidden.
29+
*
2630
*/
31+
if (backdropBreakpoint === 1) {
32+
return 0;
33+
}
34+
2735
const slope = 1 / (1 - backdropBreakpoint);
2836

2937
/**

0 commit comments

Comments
 (0)