- 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:
- 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
- Created a new content type called "Image page", which includes an image field where the display mode is set to Colorbox.
- Created content using this content type, attaching an image.
- Upon clicking the image, the Colorbox popup does not open as expected. Instead, the image opens directly in a new tab or window.
- From the Colorbox module directory (modules/contrib/colorbox), I switched to the branch 3475297-does-not-open.
- π¨π΄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:
- Install Drupal [core version]
- Install colorbox [module version]
- Install colorbox library
- Install dompurify library (if you need it)
- 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!