Skip to content

Commit

Permalink
fix(modal): backdrop animation when backdropBreakpoint is 1 (#25430)
Browse files Browse the repository at this point in the history
Resolves #25402
  • Loading branch information
sean-perkins authored Jun 13, 2022
1 parent 7b105a3 commit c10df52
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/components/modal/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getBackdropValueForSheet } from './utils';

describe('getBackdropValueForSheet()', () => {
it('should return a valid integer when backdropBreakpoint is 1', () => {
/**
* Issue: https://github.com/ionic-team/ionic-framework/issues/25402
*/
const backdropBreakpoint = 1;
expect(getBackdropValueForSheet(1, backdropBreakpoint)).toBe(0);
});
});
8 changes: 8 additions & 0 deletions core/src/components/modal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
*
* This is simplified from:
* m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
*
* If the backdropBreakpoint is 1, we return 0 as the
* backdrop is completely hidden.
*
*/
if (backdropBreakpoint === 1) {
return 0;
}

const slope = 1 / (1 - backdropBreakpoint);

/**
Expand Down

0 comments on commit c10df52

Please sign in to comment.