Skip to content

bug: Popover backdrop not included in production builds #24129

Closed

Description

@jvartanian

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

In our Ionic React application, we are using the IonPopover component with the backdrop enabled.

When developing locally using npm run start, the popover opens and the backdrop is shown. Clicking outside of the popover closes it as expected.

However, when we deploy to our dev environment, the backdrop is not being shown, and the popover cannot be closed by clicking outside of it.

After some investigation, it appears that the IonBackdrop component is being marked as dead code during tree shaking, and not being included in the bundles created by npm run build.

Explicitly referencing the IonBackdrop somewhere in our code fixes the problem (i.e. console.log(IonBackdrop)).

Expected Behavior

After building and deploying the application, the backdrop should show and the user should be able to close the Popover by clicking outside of it.

Steps to Reproduce

  1. Create a blank React Ionic v6 project
  2. Add an IonButton and an IonPopover, with the button triggering the popover.
  3. Build the application: npm run build
  4. Run the application using a package such as serve
  5. Click on the button
  6. The popover shows without a backdrop

Code Reproduction URL

https://github.com/jvartanian/backdrop-tree-shaking

Ionic Info

Ionic:

Ionic CLI : 6.18.0 (~/.nvm/versions/node/v16.6.2/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 6.0.0-rc.1

Capacitor:

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

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v16.6.2 (/Users/justinvartanian/.nvm/versions/node/v16.6.2/bin/node)
npm : 7.20.3
OS : macOS Big Sur

Additional Information

No response

Activity

  1. added
    type: buga confirmed bug report
    v6issues specific to Framework v6
    on Nov 1, 2021
  2. willmartian commented on Nov 11, 2021

    @willmartian
    Contributor

    This issue has been resolved in #24191, and the fix will be available in Ionic v6.0.0-rc.3. Thanks for the bug report!

  3. ionitron-bot commented on Dec 11, 2021

    @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.

  4. locked and limited conversation to collaborators on Dec 11, 2021
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

    package: core@ionic/core packagetype: buga confirmed bug reportv6issues specific to Framework v6

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions