question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: modal renders wrong first time loaded if <ion-range> is used in translucent footer toolbar

See original GitHub issue

Bug Report

Ionic version:

[ ] 4.x [x] 5.x

Current behavior: If you have a modal with a fullscreen ion-content and translucent ion-header and ion-footer with a toolbar containing an ion-range (or an ion-radio-group, same behavior), the ion-content will not be rendered fullscreen the first time you open the modal. After the first time it will work if you open it again. It’s hard to explain, better check the example out I made, it’s a very eye-catching bug…

Expected behavior: The ion-content is always fullscreen, not only from the second time opening it on.

Steps to reproduce: New Ionic Angular app with Ionic 5.2.2 and Angular 9.1.9. Bug occurs in Android App, iOS App or with ionic serve.

Related code:

Simple new Ionic project with a modal with the bug

Other information: This worked with Ionic 4 and stopped working after migrating to Ionic 5. I already opened a topic in the Ionic Forum with more information about hoe I found the bug and where it’s occuring in my real project.

Ionic info:

Ionic:

   Ionic CLI                     : 6.10.1
   Ionic Framework               : @ionic/angular 5.2.2
   @angular-devkit/build-angular : 0.901.9
   @angular-devkit/schematics    : 9.1.9
   @angular/cli                  : 9.1.9
   @ionic/angular-toolkit        : 2.2.0

Utility:

   cordova-res : not installed
   native-run  : 1.0.0

System:

   NodeJS : v12.16.3
   npm    : 6.14.4
   OS     : Windows 10

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
liamdebeasicommented, Jun 25, 2020

I have confirmed this as a bug. When ion-content sets its offsets, it relies on offsetHeight. If a parent element has display: none, the offset values will be 0 (similar to how offsetParent will be null). When the modal is used for the first time, there is a race condition where the offsets are set before display: none is removed from ion-modal.

2reactions
mhartingtoncommented, Jun 25, 2020

Took a look @liamdebeasi

It seems that when the modal is first opened, the padding offsets are not applied on first show. Meaning we get a solid background.

Screen Shot 2020-06-25 at 10 49 12 AM

Looking at the dom, the --offset-top and --offset-bottom vars are set to 0 on first show. Screen Shot 2020-06-25 at 10 50 42 AM

Then on subsequent shows, they are set correctly.

Screen Shot 2020-06-25 at 10 51 22 AM

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: modal renders wrong first time loaded if <ion-range ...
Current behavior: If you have a modal with a fullscreen ion-content and translucent ion-header and ion-footer with a toolbar containing an ion- ......
Read more >
Canvas page with header/footer displayed wrong when ...
I have a modal with a canvas to draw on pictures. The canvas is fullscreen and there are translucent toolbars in the header...
Read more >
Ionic modal and content not rendering well
I created a modal component but it only renders the content well when opening it the first time. Subsequent openings the modal does...
Read more >
signature=14611b395b980b0944234a35b2c772db,ionic- ...
modal : properly target card modal for iPadOS styles (#20884) (5816cf5). 5.0.6 (2020-03-25). Bug Fixes. all only warn invalid mode if used on ......
Read more >
Ionic 5 UI Components Properties
This section provides an overview of the Ionic 5 UI components and their properties available in the visual App Builder PALETTE.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found