- Issue created by @wendell
- Status changed to Needs review
11 months ago 6:32pm 20 December 2023 - ๐บ๐ธUnited States malik.kotob
I ran into this same issue! The patch as-is didn't quite work, but not because the code itself wasn't sound. It seems the patch formatting itself had an issue? Here's the patch I used (the code was borrowed @wendell in the original patch). Note that I was able to reproduce this when adding an inline block via Layout Builder.
- Status changed to Needs work
11 months ago 8:48pm 20 December 2023 I encountered a similar issue while using the Gin Toolbar module. This module modifies the toolbar's ID to
gin-toolbar-bar
, making it untargetable in toolbar.js.- ๐ท๐ธSerbia darko_antunovic
I am attaching a video recording of the behaviour that I am encountering.
- ๐ธ๐ฎSlovenia KlemenDEV
This allso happens with Bootstrap's modal dialogs
- ๐ฌ๐งUnited Kingdom Alina Basarabeanu
The patch fixed the Ajax error on Drupal 10.2, the Gin theme 8.x-3.0-rc8 and the Gin Layout Builder 1.0.0-rc5.
As mentioned above the Gin Layout Builder modified the ID for the secondary toolbar to "gin-secondary-toolbar" and the code from the toolbar.js fails to find the element in the DOM.
It is always safer to check if the element exists before applying a style.
We will use the patch from #2 to fix the issue. - ๐ฏ๐ตJapan tyler36 Osaka
Patch #2 fixes issue for me with Drupal 10.2.1, the Gin theme 8.x-3.0-rc8 and the Gin Layout Builder 1.0.0-rc5.
Thank you.
- ๐บ๐ฆUkraine EvilArgest
#2 works for me with Drupal 10.2.2 and Gin 8.x-3.0-rc7. Thanks.
- Status changed to RTBC
10 months ago 12:37am 25 January 2024 - Status changed to Needs work
10 months ago 3:19am 25 January 2024 - last update
10 months ago 25,830 pass, 1,794 fail - ๐บ๐ฆUkraine Taran2L Lviv
The test is hard to make because it happens only with the conjunction of gin/gin toolbar because gin removes some classes and toolbar.js does not have a proper check whether element exists (which should be a good practice anyways). Gin Toolbar has 30k+ installs, pretty big impact imho
- ๐บ๐ธUnited States jhedstrom Portland, OR
#2 also resolves this with Gin and Layout Builder. I'm bumping to Major is it makes LB un-usable. A test may be tricky since this seems to only be surfaced by Contrib modules...
- ๐บ๐ธUnited States mlncn Minneapolis, MN, USA
Running into this in putting a Drupal.dialog (not ajax) in a contrib module.
This patch fixes it for me, but the fact that adding a dialog in my module triggered this problem in toolbar makes me wonder if i am not doing something to scope my dialog correctlyโ or if dialog has a bigger bug?
- ๐ฑ๐นLithuania mindaugasd
My error was not mentioned
toolbarBar is null
, but search still worked fine to find this issue.Patch fixed the error after clearing Drupal and Browser caches.
Interesting fact: custom link dialog ( https://www.drupal.org/docs/develop/drupal-apis/ajax-api/ajax-dialog-boxes โ ) + bootstrap theme + css + js keeps braking (in multiple ways per upgrade) every single time I update Drupal for years.
- ๐ธ๐ฎSlovenia KlemenDEV
I will try to test if this is the case for this issue too when I get some time: https://www.drupal.org/project/ajax_comments/issues/3412943 ๐ Delete comment modal dialog broken with Drupal 10.2.x Active
It is also custom link dialog + bootstrap theme + css + js
- ๐ธ๐ฎSlovenia KlemenDEV
I can confirm patch #2 fixes https://www.drupal.org/project/ajax_comments/issues/3412943 ๐ Delete comment modal dialog broken with Drupal 10.2.x Active , however, the look (CSS styling) of the popup dialog is still broken
- ๐ธ๐ฎSlovenia KlemenDEV
I think the issue is deeper as this patch only fixes the consequence, but not the reason why styles are not properly passed to AJAX dialogs/popups
- ๐ฌ๐งUnited Kingdom SirClickALot Somerset
I would just like to raise the question that this issue is marked as
Version: 11.x-dev
but that it is definitely an issue for Drupal10.2.3
too.
I think my statement is backed up by this issue ๐ Drupal ajax error after D10 update from version 10.0.11 to 10.2.1 Needs review .Thanks all, if I'm wrong then please someone put me right!
- ๐ธ๐ฎSlovenia KlemenDEV
It seems multiple modules as well as the core itself were affected by some change in 10.2 that caused this. This issue prevents many websites from updating to 10.2, while 10.1 EOL is getting closer and closer (17. 6. 2024)
- ๐จ๐ญSwitzerland lukas.fischer
I just successfully tested https://www.drupal.org/files/issues/2023-12-20/fix-toolbarjs-null-handli... โ on 10.2.4
- First commit to issue fork.
- Merge request !7333Issue #3409505: Uncaught TypeError: Cannot read properties of null (reading 'style') (toolbar.js) โ (Closed) created by sakiland
- ๐ท๐ธSerbia sakiland
I've just created MR with implemented @wendell and @malik.kotob work and additional check.
Here's also patch for this
- ๐ธ๐ฎSlovenia KlemenDEV
Is this needs work, or needs review?
The last patch seems to fix the ajax part of the problem I had
- Status changed to Needs review
7 months ago 1:52pm 26 April 2024 - ๐ฌ๐งUnited Kingdom longwave UK
Following ๐ฑ [policy, no patch] Better scoping for bug fix test coverage RTBC I don't think tests are required here.
The issue has clear steps to reproduce, and the fix is trivial - just a guard against NULL. It has already been verified with manual testing by people in this issue. It is self-contained to the toolbar JS, doesn't require any new code, a regression will only leave us back where we started, and adding test coverage is tricky without jumping through a lot of hoops.
The patch looks good to me, marking NR for someone to confirm I have applied the new testing gate correctly above.
- ๐บ๐ธUnited States luke.leber Pennsylvania
A b/c break was inadvertently added by https://git.drupalcode.org/project/drupal/-/commit/6a43b511df9e26aa5abf0... when jquery was swapped out for vanilla JS.
Previously, jQuery was more tolerant of an element not found condition. The vanilla JS results in an uncaught exception.
I was going to remove the needs tests tag, but Dave beat me to it :D
- Status changed to RTBC
7 months ago 4:44pm 26 April 2024 - ๐ฌ๐งUnited Kingdom longwave UK
Oh, if the break was in that issue then I'm even more confident from reading the diff there. Happy to mark this RTBC and let another committer confirm.
- ๐ฌ๐งUnited Kingdom longwave UK
Also adding the regression title tag given that this used to work and we broke it in 10.2.
- Status changed to Fixed
7 months ago 1:33pm 27 April 2024 -
longwave โ
committed e4949440 on 10.2.x authored by
nod_ โ
Issue #3409505 by sakiland, wendell, malik.kotob, darko_antunovic,...
-
longwave โ
committed e4949440 on 10.2.x authored by
nod_ โ
- ๐ฌ๐งUnited Kingdom longwave UK
This is eligible for a bug fix release in 10.2.x, cherry-picked it back there as well.