Skip to content

bug: ion-backdrop not dismissing when visible property set to false #26953

Closed as not planned

Description

@timstoute

Describe the Bug

the ion-backdrop component is not dismissing when the visible property is set to false

I observe this even with the linked Ionic documentation stackblitz: https://stackblitz.com/edit/angular-vrhkzg?file=src%2Fapp%2Fexample.component.html

myionic info output included below

Expected Behavior

i expect that when the ion-backdrop visible property is set to false that the overlay will disappear

Steps to Reproduce

This is reproducible for me with the StackBlitz code included in the Ionic Documentation (v6) linked form this page: https://ionicframework.com/docs/api/backdrop#properties

Ionic Info

Ionic CLI : 6.20.8 (/home/xxx/.nvm/versions/node/v17.9.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.4.1
@angular-devkit/build-angular : 15.0.1
@angular-devkit/schematics : 15.0.1
@angular/cli : 15.0.1
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 4.3.0
@capacitor/android : not installed
@capacitor/core : 4.3.0
@capacitor/ios : 4.3.0

Utility:

cordova-res : not installed globally
native-run (update available: 1.7.2) : 1.7.1

System:

NodeJS : v17.9.0 (/home/xxx/.nvm/versions/node/v17.9.0/bin/node)
npm : 8.12.2
OS : Linux 5.15

Screenshots

No response

Operating System

Linux Ubuntu 20.04.5

Browser

Chrome

Version

Version 111.0.5563.64 (Official Build) (64-bit)

Additional Information

No response

Activity

  1. averyrousseau commented on Mar 14, 2023

    @averyrousseau
    Contributor

    Thank you for the issue. Just to make sure I understand, do you mean that the blue backdrop remains visible even with visible="false"?

    If so, this is due to the following CSS in that playground, in example.component.css:

    ion-backdrop {
      opacity: 0.9;
      background: var(--ion-color-primary);
    }
    

    This overrides the CSS that hides the backdrop when the visible property is set. If I remove that CSS, the backdrop disappears.

  2. added
    needs: reply
    on Mar 14, 2023
  3. removed their assignment
    on Mar 14, 2023
  4. timstoute commented on Mar 14, 2023

    @timstoute
    Author

    Ok, thanks for looking at this; perhaps I'm misunderstanding the intended behavior of the component.

    But, even with the Basic Usage example from the documentation , looking at the StackBlitz, I'm still unable to interact with the button or the checkbox control unless I completely remove the <ion-backdrop [visible]="false"></ion-backdrop> tag from the page. Setting [visible]="false" does not allow me to interact with the button or the checkbox.

    I expected that if I set the [visible]="false" I would be able to interact with the page elements.

  5. added and removed
    needs: reply
    on Mar 14, 2023
  6. averyrousseau commented on Mar 15, 2023

    @averyrousseau
    Contributor

    On further investigation, it looks like the visible property was mostly created for internal use, to enable the showBackdrop property on ion-modal: https://ionicframework.com/docs/api/modal#showbackdrop All setting visible="false" does is make the backdrop invisible, but have it still prevent interaction with other elements. If you would like to be able to interact with the page elements, I would recommend setting display: none on the backdrop through CSS, or not rendering the backdrop at all.

    I'm going to close this issue as the visible property is working as intended. However, we're going to investigate internally on whether it would be better to remove the prop entirely in a future release, as it's possible that we don't need it as a public API. Thank you again for raising this issue.

  7. ionitron-bot commented on Apr 14, 2023

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  8. locked and limited conversation to collaborators on Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions