Closed (works as designed)
Project:
Layout Builder Modal
Version:
8.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Nov 2020 at 21:51 UTC
Updated:
2 Apr 2021 at 20:58 UTC
Jump to comment: Most recent

Comments
Comment #3
miroslav-leeComment #4
mark_fullmerAlthough I would love for the theme switch to be as easy as using Drupal's ThemeNegotiator approach, I do not believe this, on its own, will be sufficient. My understanding is that this is because the ThemeNegotiator requires the context of the route to determine what the theme should be (see related discussion at #2292217: ThemeNegotiator::determineActiveTheme() should not require a RouteMatch to be passed in), and since the Layout Builder Modal and the Media Library are initiated outside of the context of a route, they cannot reliably be designated to use a theme via ThemeNegotiator.
Specifically, this conundrum is discussed in #3050508: Media library loads front-end theme when invoked from settings tray.
As confirmation of this, when I functionally test this merge request, I do see that some of the CSS provided by the selected theme does appear to load, presumably because it was loaded during previous route match (such as
layout_builder.add_block), but in the context of the modal itself, the theme is not actually being used. To give one example, inspecting both the HTML markup produced in that context or the CSS loaded for.ui-dialog .ui-dialog-titlebarshows that the active default theme, rather than an administrative theme is used.This problem is why Layout Builder Modal has gone to such lengths to implement the course of action indicated in https://www.drupal.org/project/drupal/issues/3050508#comment-13522943 , as can be seen in the not insignificant amount of CSS it is adding to the active theme.
Fortunately, there is another contributed module that provides the solution to what is reported here: https://www.drupal.org/project/media_library_theme_reset
Again, if I'm missing something about the potential for the ThemeNegotiator to be sufficient here, please *please* correct me, as that would be a much simpler resolution!
If you agree with the above analysis, let's go ahead and mark this issue as "Closed (works as designed)."
Comment #5
miroslav-leeThank you a lot for your answer.
The module which you recommend works.