- Issue created by @mohammedOdeh
- π―π΄Jordan Rajab Natshah Jordan
I confirm the issue
Which version of Varbase or its components (Varbase 10.0.x-dev development, the latest release, Varbase Components, or Vartheme BS5) are you facing this issue with?
How did the issue develop after the changes in π Fix dropdown menu limited to only two levels Fixed ? Could you describe what happened?
#3456935 was committed, but not released yet.
- π―π΄Jordan mohammedOdeh
I'm using Varbase 10.0.x-dev, Varbase Components version 2.0.2+1-dev, and Vartheme BS5 version 3.0.0-rc1+1-dev.
I don't believe the issue is related to the changes from #3456935: Fix dropdown menu limited to only two levels, as the problem persists regardless of that patch.
- Status changed to Needs work
4 months ago 11:59am 21 August 2024 - π―π΄Jordan Rajab Natshah Jordan
Thanks, Odeh, for reporting.
I faced the issue in https://www.drupal.org/project/varbase_components/issues/3456935#comment... π Fix dropdown menu limited to only two levels FixedNoted;
Let us have this fixed with a merge request.
Maybe in both Varbase Components and Vartheme BS5 - Assigned to Rajab Natshah
- Status changed to Active
4 months ago 2:07pm 28 August 2024 - π―π΄Jordan Rajab Natshah Jordan
Progress findings:
The Responsive Theme Preview β module is loading its Popper.js library
dropdown.js
andtooltip.js
are allocating the library by@popperjs/core
Not by itβs physical file location and name space.
@popperjs/core@2.9.2
is working but 2.11.8 is not(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js')) : typeof define === 'function' && define.amd ? define(['@popperjs/core', './base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global["@popperjs/core"], global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index)); })(this, (function (Popper, BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js) { 'use strict';
Bootstrap 5.3.3 is using
"@popperjs/core": "^2.11.8",
https://github.com/twbs/bootstrap/blob/main/package.json#L110C5-L110C33
The 3 file formats are:
esm
(works with import syntax )umd
(works with
tags or RequireJS)cjs
(works with require() syntax)
umd
in Varbase Components, and Vartheme BS5 Theumd
format in Bootstrap is doingesm
format. This is the issue. - π―π΄Jordan Ahmad Khader
hi @rajab_natshah
I have switched to bootstrap.bundle.min.js in my projects due to this error, along with other issues related to Bootstrap components. You can read more about it here: https://stackoverflow.com/questions/68750341/bootstrap-5-uncaught-typeer....However, if you prefer to resolve the issue without transitioning to the bundled version, you must modify the global property from global["@popperjs/core"] to global. Popper in dropdown.js. This adjustment is necessary as it addresses the underlying issue. It is essential to ensure that the global properties are correctly defined and accessible. Utilizing string-based property access (global["@popperjs/core"]) is less common and may lead to complications if the global object properties are not configured as anticipated.
- π―π΄Jordan Rajab Natshah Jordan
Using
bootstrap.bundle.min.js
will definitely fix the issue.But that is not the right way.
That will work if you did this in projects ), but not as it was designed and structured for!!
As we work with SDC - it was requested by Razem ( not to load duplicate libraries, - or not to load extra not-needed JS in components )
This is a step toward moving our work with SDC with React Components.- Issue #3423174 β : Added Bootstrap ~5.3.0 JavaScript libraries in Varbase Components and only attach them with needed SDC components
- Issue
#3423178 β
: Moved all Bootstrap
~5.3.0
JavaScript libraries to Single Directory Components (SDC) in Varbase Components
We must find a way to make this work, maybe compile js files in our way.
- π―π΄Jordan Rajab Natshah Jordan
NOTICE: The Responsive Theme Preview β module is loading its
Popper.js
library. ( @popperjs/core v2.11.6 )
It is using an old version of popper .. not the 2.11.8 one with Bootstrap 5.3.3 - π―π΄Jordan Ahmad Khader
@rajab_natshah,
Hmmm, It's differently an issue but I think it's unrelated to this error since disabling the Responsive Theme Preview module won't fix the error.I added a patch to test global object properties fix.
- π―π΄Jordan Rajab Natshah Jordan
That will work for ones, but when we update bootstrap?
it is a nodejs package too ( not a composer one )The right way to do this is in the webpack.config.init.js
a JS script to re-compile, string manipulate thedropdown.js
andtooltip.js
as in this comment π Error: Uncaught TypeError: Popper__namespace.createPopper is not a function when adding a dropdown in the navbar Needs workThis will allow this to work in Vartheme BS5 and any custom generated cloned theme
we need a commend for updates .. like
drush updb
but it could be something likedrush var-update-theme mytheme
Now the command to do this is
yarn theme:init
I will continue with your fix idea .. but in the webpack.config.init.js file
-
rajab natshah β
committed fd9e8c3e on 3.0.x
Issue #3469222: Fix Popper.js Error When Adding Navbar Dropdown in...
-
rajab natshah β
committed fd9e8c3e on 3.0.x
- Issue was unassigned.
- Status changed to Needs review
4 months ago 2:57pm 1 September 2024 - π―π΄Jordan Rajab Natshah Jordan
- π―π΄Jordan Rajab Natshah Jordan
Steps to follow to run the Bootstrap Fixer in old projects
Open the terminal and change directory to the custom theme
cd MY_PROJECT/themes/cusotm/mytheme
Get the Bootstrap Fixer file.
wget https://git.drupalcode.org/project/varbase_components/-/raw/2.0.x/bootstrap.fixer.js
Change
"theme:init"
in package.json to"theme:init": "webpack --progress --config webpack.config.init.js ; node bootstrap.fixer.js",
Add
"bootstrap:fixer": "node bootstrap.fixer.js",
to"scripts"
in the package.json file.The package.json file should look as in this link
run the following:
yarn bootstrap:fixer
- Status changed to Fixed
4 months ago 10:00am 2 September 2024 Automatically closed - issue fixed for 2 weeks with no activity.