Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(modal): backdrop animation when backdropBreakpoint is 1 #25430

Merged
merged 11 commits into from
Jun 13, 2022
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