Skip to content

Different window.open in an async call behaviour between Webpack 4 & Webpack 5 #18018

Closed

Description

@samiashi

Bug report

What is the current behavior?
Using the same React component we get different experiences when building with Webpack 4 & Webpack 5 on iOS devices

Clicking a button to open a new tab in an async call would only work when building with Webpack 4.
When building with Webpack 5 the new tab does not open when you click the button. The popup gets blocked.

Note: Clicking the button on Chrome/Firefox desktop works as expected (opens new tab) on both Webpack 4 & Webpack 5.

I understand that the code that triggers the new tab might not be the best but I'm really curious to understand why this works with Webpack 4 and doesn't with Webpack 5. And how come it only seems to affect Apple devices 🤔

If the current behavior is a bug, please provide the steps to reproduce.

I've created a repo to reproduce the issue https://github.com/samiashi/react-webpack-debug
Instructions are included there as well to reproduce the issue

  1. Install the desired Webpack version (4.47.0 or 5.90.0)
  2. Run npm run start
  3. Using Xcode Simulator, open an iPhone (I've been testing with iPhone 15 running iOS 17.0) or open on real iPhone device or using Safari on Desktop
  4. Navigate to http://localhost:8080
  5. Click on the button

What is the expected behavior?
Clicking a button to open a new tab inside an async call should work when building with Webpack 4 & Webpack 5 on iOS.

Running with Webpack 4

webpack4.mov

Running with Webpack 5

webpack5.mov

Other relevant information:
webpack version: 5.90.0
Node.js version: v18.18.2
Operating System: iOS
Additional tools:

Activity

  1. changed the title [-]Different behaviours between Webpack 4 & Webpack 5[/-] [+]Different behaviour between Webpack 4 & Webpack 5[/+] on Jan 27, 2024
  2. changed the title [-]Different behaviour between Webpack 4 & Webpack 5[/-] [+]Different window.open in an async call behaviour between Webpack 4 & Webpack 5[/+] on Jan 27, 2024
  3. alexander-akait commented on Jan 30, 2024

    @alexander-akait
    Member

    Please open the safari dev tools console and look at the output

  4. samiashi commented on Feb 5, 2024

    @samiashi
    Author
  5. alexander-akait commented on Feb 5, 2024

    @alexander-akait
    Member

    I am sure there are no problems with webpack, we don't override your code and don't change logic, maybe something with dev env, I will investigate it later

  6. samiashi commented on Feb 5, 2024

    @samiashi
    Author

    Many thanks @alexander-akait
    I’m very keen to hear about your findings

    just to note that I get the same issue when I build for production on version 5

  7. locked and limited conversation to collaborators on Feb 14, 2024
  8. converted this issue into a discussion #18079 on Feb 14, 2024
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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions