Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Make a change to a view such as changing the label for a field, and the top dropbutton gets ornery
Proposed resolution
Fix it so the dropbutton works in the manner we expect dropbuttons to work.
Remaining tasks
Fix the bug, get it reviewed, commit.
User interface changes
A not-broken dropbutton in views.
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff.txt | 6.17 KB | lauriii |
#24 | 3067085-24.patch | 10.01 KB | lauriii |
#24 | 3067085-24-test-only.patch | 4.07 KB | lauriii |
#21 | claro-views_ui_menu_tabs-3067085-21--complete.patch | 10.98 KB | huzooka |
#21 | claro-views_ui_menu_tabs-3067085-21--test-only.patch | 5.04 KB | huzooka |
Comments
Comment #2
bnjmnmThis appears to be due to
claro_form_view_edit_form_alter
not being called when the Views UI is rebuilt via Ajax. Commenting here in case someone reading this already has an idea how to best go about addressing this.Comment #3
bnjmnmSetting to postponed - after working on this I believe it is actually a Views UI issue, and I created an issue (with patch and test) #3067386: AJAX rebuild of Views UI form re-renders parts of the form without using Form API, so additional hooks are needed in lieu of hook_form_view_edit_form_alter()
Leaving this open but postponed in case this is addressable with Claro, or if the Views UI fix does not fully address the symptoms.
Comment #4
huzookaComment #5
andypostComment #6
huzookaComment #7
huzookaComment #8
huzookaAdded a test for the Views UI Menu Tabs. (It does not tests the currently broken dropbutton.)
The test tries to verify that the
views-tabs
and theviews-tabs--secondary
CSS classes can be found on the view ui menu tabs element even before and after an AJAX refresh.Comment #9
huzookaRemoved some redundancy.
Comment #12
huzookaComment #13
huzookaComment #14
huzookaTechnically I only applied the patch that I got from @lauriii.
#13 added a new test case for the extra actions dropbutton.
Comment #15
huzookaFrom @lauriii:
He's totally right.
Comment #16
huzookaComment #17
lauriiiThis documentation seems unrelated.
Are we able to use the new
$defaultTheme
property for setting Claro as the testing theme?Comment #18
huzookaComment #19
huzookaThis addresses #17.
Comment #20
huzookaComment #21
huzookaComment #23
phenaproximaNice work! I began by reading the test-only patch, and found some things that should probably be changed to make it more reliable and less verbose. 🤓
This can basically be all one line:
This could also be one line, since WebAssert::elementExists() returns the element in question:
This is an incorrect use of waitForElement(). It returns a boolean, but does not actually assert that the element appeared. So, this needs to be:
$this->assertTrue($this->assertSession()->waitForElement('css', '.js-views-ui-dialog'));
Again, this can be more assertive as a single line:
$this->assertSession()->elementExists('css', '.js-views-ui-dialog .ui-dialog-buttonpane')->pressButton('Apply');
assertWaitOnAjaxRequest() is bad news and should not be relied upon. However, I see that in this case we probably will not be able to do anything else, so no need to change this. But in general, one should wait on the expected condition, rather than the more nebulous "an AJAX request has finished".
Comment #24
lauriiiThis should address all feedback from #23 😇
Comment #26
tim.plunkettThe split of
claro_form_view_edit_form_alter()
into the two new hooks looks great.In the first,
$form['displays']['top']
is replaced with$element
, no other changes.In the second,
$form['displays']['settings']['settings_content']['tab_content']
is replaced with$element
, no other changes.Technically that function signature should read
&$build, ViewUI $view, $display_id
I don't know that it matters, thought I'd call it out.
I've never seen a docblock with newlines like that, but phpcs isn't flagging it, so I guess it's okay.
Comment #27
effulgentsia CreditAttribution: effulgentsia at Acquia commentedAdding reviewer credit.
Comment #30
effulgentsia CreditAttribution: effulgentsia at Acquia commentedPushed to 9.0.x and 8.9.x.
If someone wants to take up either or both of the items in #26 in a followup, go for it.
I'll open a separate issue for cherry picking all the 8.9 Claro related commits to 8.8.
Comment #32
effulgentsia CreditAttribution: effulgentsia at Acquia commentedPushed to 8.8.x. See #3088437: Cherry pick Claro to Drupal 8.8. for details.