Does not open in page

Created on 18 September 2024, 3 months ago

Problem/Motivation

When clicking on links they are opening in a new window instead of creating a modal on the same page.

Steps to reproduce

Install module. goto configuration page. Clicking on demo links are all opening in a new tab.

Proposed resolution

This should be opening on top of the same window

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Active

Version

2.1

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States phelix

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @phelix
  • πŸ‡¨πŸ‡΄Colombia ismaelromero Somewhere in the exotic Colombia

    Hi there,

    I'm taking a look at the issue with Colorbox 2.1.1 where links are opening in new tabs instead of a modal. I'll update here once I've made some progress.

    Cheers

  • πŸ‡¨πŸ‡΄Colombia ismaelromero Somewhere in the exotic Colombia

    To replicate the issue, I followed these steps using Drupal 11:

    1. From the Colorbox module directory (modules/contrib/colorbox), I switched to the branch 3475297-does-not-open.
      Installed the required DOMPurify library, necessary for the proper functioning of the module, using the following command:
      drush colorbox:dompurify
      You can verify the installation with the same command:
      drush colorbox:dompurify
    2. Created a new content type called "Image page", which includes an image field where the display mode is set to Colorbox.
    3. Created content using this content type, attaching an image.
    4. Upon clicking the image, the Colorbox popup does not open as expected. Instead, the image opens directly in a new tab or window.
  • πŸ‡¨πŸ‡΄Colombia ismaelromero Somewhere in the exotic Colombia

    The issue was due to the required jquery.colorbox-min.js library missing from the libraries folder. The folder structure was as follows:

    ./libraries
    └── dompurify
        └── dist
            β”œβ”€β”€ purify.cjs.js
            β”œβ”€β”€ purify.cjs.js.map
            β”œβ”€β”€ purify.es.mjs
            β”œβ”€β”€ purify.es.mjs.map
            β”œβ”€β”€ purify.js
            β”œβ”€β”€ purify.js.map
            β”œβ”€β”€ purify.min.js
            └── purify.min.js.map
    

    While searching in the Drupal forums, I found the following comment by Nevets β†’ :

    It mentions: Β«Drush users can use the command "drush colorbox-plugin"Β».

    Upon running it, Drush responded with:

    The colorbox library has been successfully downloaded to /app/web/libraries/colorbox
    

    This installed the required library with the following structure:

    ./libraries
    β”œβ”€β”€ colorbox
    β”‚   β”œβ”€β”€ bower.json
    β”‚   β”œβ”€β”€ colorbox.ai
    β”‚   β”œβ”€β”€ content
    β”‚   β”œβ”€β”€ example1
    β”‚   β”œβ”€β”€ example2
    β”‚   β”œβ”€β”€ example3
    β”‚   β”œβ”€β”€ example4
    β”‚   β”œβ”€β”€ example5
    β”‚   β”œβ”€β”€ i18n
    β”‚   β”œβ”€β”€ jquery.colorbox.js
    β”‚   β”œβ”€β”€ jquery.colorbox-min.js  <===
    β”‚   β”œβ”€β”€ LICENSE.md
    β”‚   β”œβ”€β”€ package.json
    β”‚   └── README.md
    └── dompurify
        └── dist
    

    After clearing the cache, I was able to see the image in the popup.

  • πŸ‡¨πŸ‡΄Colombia ismaelromero Somewhere in the exotic Colombia

    The issue was due to the required jquery.colorbox-min.js library missing from the libraries folder. The folder structure was as follows:

    ./libraries
    └── dompurify
        └── dist
            β”œβ”€β”€ purify.cjs.js
            β”œβ”€β”€ purify.cjs.js.map
            β”œβ”€β”€ purify.es.mjs
            β”œβ”€β”€ purify.es.mjs.map
            β”œβ”€β”€ purify.js
            β”œβ”€β”€ purify.js.map
            β”œβ”€β”€ purify.min.js
            └── purify.min.js.map
    

    While searching in the Drupal forums, I found the following comment by Nevets β†’

    It mentions: Β«Drush users can use the command "drush colorbox-plugin"Β».

    Upon running it, Drush responded with:

    The colorbox library has been successfully downloaded to /app/web/libraries/colorbox
    

    This installed the required library with the following structure:

  • πŸ‡¨πŸ‡΄Colombia ismaelromero Somewhere in the exotic Colombia

    The issue was due to the required jquery.colorbox-min.js library missing from the libraries folder.

    The folder structure was as follows:

    ./libraries
    └── dompurify
        └── dist
            β”œβ”€β”€ purify.cjs.js
            β”œβ”€β”€ purify.cjs.js.map
            β”œβ”€β”€ purify.es.mjs
            β”œβ”€β”€ purify.es.mjs.map
            β”œβ”€β”€ purify.js
            β”œβ”€β”€ purify.js.map
            β”œβ”€β”€ purify.min.js
            └── purify.min.js.map
    
    

    While searching in the Drupal forums, I found the following comment by Nevets β†’

    It mentions: Β«Drush users can use the command "drush colorbox-plugin"Β».

    Upon running it, Drush responded with:

    The colorbox library has been successfully downloaded to /app/web/libraries/colorbox
    

    This installed the required library with the following structure:

    ./libraries
    β”œβ”€β”€ colorbox
    β”‚   β”œβ”€β”€ bower.json
    β”‚   β”œβ”€β”€ colorbox.ai
    β”‚   β”œβ”€β”€ content
    β”‚   β”œβ”€β”€ example1
    β”‚   β”œβ”€β”€ example2
    β”‚   β”œβ”€β”€ example3
    β”‚   β”œβ”€β”€ example4
    β”‚   β”œβ”€β”€ example5
    β”‚   β”œβ”€β”€ i18n
    β”‚   β”œβ”€β”€ jquery.colorbox.js
    β”‚   β”œβ”€β”€ jquery.colorbox-min.js  <===
    β”‚   β”œβ”€β”€ LICENSE.md
    β”‚   β”œβ”€β”€ package.json
    β”‚   └── README.md
    └── dompurify
        └── dist
    

    After clearing the cache, I was able to see the image in the popup.

  • πŸ‡ΊπŸ‡ΈUnited States paulmckibben Atlanta, GA

    Hi @ismaelromero, thank you for explaining that the colorbox library needs to be installed in order for colorbox to work.

    @phelix, does this solve your issue? If not, please provide a reliable set of steps on a clean installation of Drupal to reproduce the issue, including:

    1. Install Drupal [core version]
    2. Install colorbox [module version]
    3. Install colorbox library
    4. Install dompurify library (if you need it)
    5. Any additional setup steps you performed (e.g. setting display mode of your image field)

    If you can provide those steps and I can reproduce the issue, I'll be glad to help. Thanks!

Production build 0.71.5 2024