Problem/Motivation
Without spending all of the time to find out historically why this was done, or to think through all implications of this change, I believe that AjaxBasePageNegotiator is too restrictive.
It's stated intent is to prevent CSS from loading from two different themes on an Ajax request.
However, in order to do that, the route must declare _theme: ajax_base_page
in its route options.
And if there are multiple modals in a row, each route must declare this.
However, the route author should not need to know in advance that the route would be used in a modal, it should Just Work™.
Proposed resolution
Remove the explicit check for _theme: ajax_base_page
and instead use the check for ajax_page_state.
Remaining tasks
Needs manual testing:
Verify that Quick Edit still works fine, both when using Seven as the admin theme and Bartik as the default theme, and when Bartik is the default and admin theme.
User interface changes
N/A
API changes
Possibly?
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#35 | interdiff.txt | 1.38 KB | tim.plunkett |
#35 | 2745953-ajax-34.patch | 14.23 KB | tim.plunkett |
#32 | 2745953-ajax-32.patch | 14.23 KB | tim.plunkett |
#32 | interdiff.txt | 2.51 KB | tim.plunkett |
#28 | interdiff.txt | 801 bytes | dawehner |
Comments
Comment #2
tim.plunkettComment #3
dawehnerI agree, it doesn't really make sense.
Should this issue remove the other instances of it in core?
Comment #4
tim.plunkettI don't see why not.
Comment #5
dawehnerNIce, it returned green. I guess we still have tests for the general feature. I guess we need a change record for that?
Comment #6
tim.plunkettI'm a little worried about this change.
I uploaded this change to a test issue, and it passed:
To me that indicates that we have NO test coverage for this functionality.
Comment #7
Wim LeersThis is an excellent, excellent point.
I think this is really just a remnant from D7 and before. We now have the ability to render anything in a modal. Which means it'd be even wrong to set
_theme: ajax_base_page
in those cases!I'm not surprised, our test coverage for AJAX/dialog/modal is poor. :( Because it stems from D7 and before.
Comment #8
pwolanin CreditAttribution: pwolanin as a volunteer commentedWhat would some minimal test coverage look like here? Obviously the JS testing isn't in place enough I don't think to actually test the ajax?
Comment #9
tim.plunkettHere's a unit test.
This needs some manual testing from someone not me:
Verify that Quick Edit still works fine, both when using Seven as the admin theme and Bartik as the default theme, and when Bartik is the default and admin theme.
Comment #10
tim.plunkettComment #11
davidhernandezI tried quick edit with multiple themes set on the front end and back end. I didn't notice any difference in functionality.
Comment #13
dawehnerDid some manual testing , and well, as you see, the right theme is used.
This statement is obviously wrong ;)
Note: The interdiff and the fail patch are identical.
Comment #16
dawehnerMissing @group. Note, the interdiff is still relative to #9
Comment #19
Wim LeersThis is not used anywhere.
Whitespace nit.
Comment #20
dawehnerThank you wim!
Do you sometimes have these moments when you really question how it could have passed locally?
Comment #22
pwolanin CreditAttribution: pwolanin as a volunteer commentedThis is leftover debug code?
Comment #23
dawehnerSure, totally.
Comment #24
Wim LeersToo often!
10 seconds?!
Comment #25
dawehnerYeah not sure about this value. I just copied it from
\Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::waitForAjaxToFinish
. Note: this is also just a timeout when the actual functionality doesn't work.Comment #26
tim.plunkettOpened #2747863: Move \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::waitForAjaxToFinish to \Drupal\FunctionalJavascriptTests\JavascriptTestBase about moving that helper method to the base class. Then we'll have one place to decide on whether 10 seconds is too much.
Comment #27
dawehnerSure, there we go.
Comment #28
dawehnerHere is the interdiff
Comment #29
tim.plunkettThe changes since #9, my patch, look great!
Can someone provide a final review?
Comment #30
dawehnerI'm RTBC for everything beside the test. If someone else gives a +1 for the test I'm super happy.
Comment #31
Wim LeersHm… we remove those two conditions because the
applies()
check already tests them for us.But that makes the code read strangely now: it looks as if we don't care if the
'theme'
and'theme_token'
array keys exist.I think this can be much simplified: remove the condition altogether. And just do
… because the
applies()
check already ensures this is only called if all those things exist.This may seem a nit, but IMO makes the code more maintainable long-term.
Second comment is incomplete.
When those things are addressed, I agree with RTBC.
Comment #32
tim.plunkettAgreed!
Comment #33
dawehnerThank you tim!
Comment #34
Wim Leers"use also use" :)
Can be fixed on commit.
RTBC++
Comment #35
tim.plunkettJust fixing the nits now to streamline it for the committers :)
Comment #36
Wim LeersNice, even more nits fixed than I noticed :P
Comment #37
dawehner@tim.plunkett++
Yeah I better setup storm to yell at me.
Comment #38
tim.plunkettThis is ready, but I think either catch or alexpott should be the one to commit it.
Comment #39
alexpottThe change looks good and I can't see any security issues that would be brought about by this change and it is great to have the additional test coverage. I think we should have a change record for this change and also search existing ones that might need an update + docs.
Comment #40
alexpottFox example https://www.drupal.org/node/2122201 will need an update for 8.2.x
Comment #41
tim.plunkettWrote https://www.drupal.org/node/2752989, that handbook page in #40 is the only one I could find. I will update those docs once this is committed.
Comment #42
Wim Leers@tim.plunkett: CR looks great, but IMO you can already make the changes to https://www.drupal.org/node/2122201. We need those docs to work for both D8.0/8.1 and >=8.2. So we need to mention both. What I've been doing is
<sup>Since 8.2.0</sup>
for version-specific things. For example: https://www.drupal.org/node/2617470/revisions/view/9118520/9372512 for https://www.drupal.org/developing/api/8/ckeditor.No other CRs talk about this, at least not according to https://www.drupal.org/list-changes/drupal/published?keywords_descriptio..., so #39 is addressed.
Comment #43
tim.plunketthttps://www.drupal.org/node/2122201/revisions/view/9795665/9799675
Comment #44
alexpottCommitted c2b2864 and pushed to 8.2.x. Thanks!
Comment #46
Wim LeersThis also fixed #2404199: quickedit.attachments ajax calls change the theme — yay!
Comment #48
xjmThis didn't really seem to fit in the release notes, but feel free to retag if I've missed some importance. A CR seems sufficient.