It came up a few times in #2762505: Introduce "outside in" quick edit pattern to core that it's strange for the "Quick edit" link to be at the top of contextual links in the "normal" site view, but in "Edit" mode it moves down below "Configure" (alphabetical order).

This seems like a pretty easy patch for someone to write, so tagging Novice.

CommentFileSizeAuthor
#57 2784567-57.patch3.76 KBtedbow
#57 interdiff-2784567-55-57.txt983 bytestedbow
#55 2784567-55.patch3.17 KBtedbow
#55 interdiff-53-55.txt1.02 KBtedbow
#53 interdiff-48-53.txt3 KBtedbow
#53 2784567-53.patch3.5 KBtedbow
#52 2784567-52.patch1.74 KBdbjpanda
#48 2784567-48.patch1.95 KBdmsmidt
#45 interdiff-42-45.txt630 bytestedbow
#45 2784567-45.patch1.92 KBtedbow
#45 2784567-45-TEST_ONLY.patch1.07 KBtedbow
#42 interdiff-41-42.txt760 bytestedbow
#42 2784567-42.patch1.92 KBtedbow
#41 2784567-41-TEST_ONLY.patch1.07 KBtedbow
#41 2784567-41.patch1.92 KBtedbow
#39 interdiff-36-39.txt3.03 KBtedbow
#39 2784567-39.patch3.27 KBtedbow
#39 2784567-39-TEST_ONLY.patch2.42 KBtedbow
#36 interdiff-33-36.txt1.08 KBtedbow
#36 2784567-36.patch2.83 KBtedbow
#33 128px-Paris_Tuileries_Garden_Facepalm_statue.jpg6.08 KBtedbow
#33 interdiff-31-33.txt825 bytestedbow
#33 2784567-33.patch2.84 KBtedbow
#31 interdiff-30-31.txt2.3 KBtedbow
#31 2784567-31.patch2.84 KBtedbow
#30 interdiff.txt2.2 KB20th
#30 2784567-30.patch1.94 KB20th
#26 2784567-26.patch2.34 KB20th
#20 Screen Shot 2016-11-21 at 9.57.42 AM.png17.48 KBtkoleary
#20 Screen Shot 2016-11-21 at 9.57.55 AM.png22.79 KBtkoleary
#19 2784567-19.patch2.34 KB20th
#16 interdiff-2784567-12-16.txt2.47 KBtedbow
#16 2784567-16-TEST_ONLY.patch1.53 KBtedbow
#16 2784567-16.patch2.38 KBtedbow
#12 list_quick_edit-2784567-12.patch877 bytesbendev
#8 list_quick_edit-2784567-8.patch880 bytescrasx
#3 quick_edit_before_configure_2784567-3.patch1.32 KBmiteshmap

Comments

webchick created an issue. See original summary.

tedbow’s picture

Component: quickedit.module » outside_in.module
miteshmap’s picture

Status: Active » Needs review
StatusFileSize
new1.32 KB

Added initial patch, Worked on JS to prioritize link on toggle of "EDIT", Works fine when we toggle "Edit" mode on page. But there's some issue when we enable "Edit" Mode and reload the page. At that time the "Quick Edit" link is not being set on top.

tedbow’s picture

Issue summary: View changes

@webchick && @miteshmap I am not seeing the problem. Maybe I don't understand.
Are you seeing the contextual links actually switch order after you click "edit" in the toolbar? For the contextual links for each block?

I always see the contextual links in the same order with "quick edit" after.
Only local images are allowed.

webchick’s picture

Sorry, my original bug report was unclear. If you're on your standard D8 site, on the front page, and hover over the contextual links for a node, "Quick edit" will be the first thing in the list. Versus when you're in "Outside-In" mode, the Quick Edit option scoots down and appears below "Configure foo." Instead, it should always be at the top of the contextual links list. Does that make sense?

miteshmap’s picture

@webchik: For me it's always "configure block" at the top. But yeah your last comment makes it clear that in any case "Quick Edit" should always be on top.

miteshmap’s picture

Status: Needs review » Needs work
crasx’s picture

StatusFileSize
new880 bytes

Here is a php attempt. It places all outside-inblock-configure links first by removing it and using array addition. I tried using #weight on the array but it doesn't look like the contextual link render respects it. I didn't dig too deep into that but it appears it could be a bug?

crasx’s picture

Status: Needs work » Needs review
bendev’s picture

will look into this at drupalcondublin2016

scuba_fly’s picture

Issue tags: +Dublin2016
bendev’s picture

StatusFileSize
new877 bytes

tested this successfully but needed to slightly reroll patch

jief’s picture

Status: Needs review » Reviewed & tested by the community

patch #12 works as expected

alexpott’s picture

Issue tags: +Needs tests

We should add a test for this?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I meant to assign to needs work for #14

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new2.38 KB
new1.53 KB
new2.47 KB

Ok this adds a test that "Quick edit" shows up first.

Also 2 other fixes.

  1. Added a period at the end of the comment
  2. Changed to use short array syntax.

TEST_ONLY patch to prove it fails without change.

Status: Needs review » Needs work

The last submitted patch, 16: 2784567-16-TEST_ONLY.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review

Just TEST_ONLY patched failed which was expected.

20th’s picture

StatusFileSize
new2.34 KB

Patch no longer applies because of the c9dbe65 commit. Rerolling updated patch.

Can anyone upload screenshots of before and after for this patch? I do not see any difference in the order of any contextual links when I apply it...

tkoleary’s picture

Looks correct to me.

Before


After

20th’s picture

Status: Needs review » Reviewed & tested by the community

Right, thanks @tkoleary!

This patch was already set to RTBC once, it has tests too, all looks good to me.

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review

Please do not RTBC your own patch.

tstoeckler’s picture

Issue tags: -Needs tests

I guess this has tests, though, now.

tkoleary’s picture

Status: Needs review » Reviewed & tested by the community

ok, I'll RTBC it. :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: 2784567-19.patch, failed testing.

20th’s picture

Status: Needs work » Needs review
StatusFileSize
new2.34 KB

That's strange. Rerolling the same patch.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Yup, that's the same patch. Thanks!

xjm’s picture

Status: Reviewed & tested by the community » Needs review
  1. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -74,6 +74,7 @@ public function testBlocks() {
    +    $this->checkQuickEditLinks(array_column($blocks, 'id'));
    
    @@ -173,4 +174,22 @@ protected function openBlockForm($block_selector) {
    +  protected function checkQuickEditLinks($block_ids) {
    

    What is the likelihood of reusing this method? Also, it seems like it has some overlap with the code that follws it in testBlocks(). Rather than looping twice over the blocks, why not add these assertions in the existing loop?

  2. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -173,4 +174,22 @@ protected function openBlockForm($block_selector) {
    +      self::assertTrue(count($links) > 1, "Block with id $block_id does not have more than 1 contextual link.");
    

    Doesn't the message here contradict what the assertion is actually asserting?

Thanks!

20th’s picture

Status: Needs review » Postponed

Postponing this issue until we have fixed #2830485: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly which marks Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testBlocks() as skipped. Until then, this patch cannot be reliably tested.

20th’s picture

StatusFileSize
new1.94 KB
new2.2 KB

In the mean time, here is an updated patch that tries to address @xjm's comments in #28.

tedbow’s picture

Status: Postponed » Needs review
StatusFileSize
new2.84 KB
new2.3 KB

Instead of postponing this issue and all others involving this test why don't we mark the test as incomplete? \PHPUnit_Framework_Assert::markTestIncomplete allows us to do this.

We can move the new asserts to the top of the loop and then skip over all others. Since our new asserts don't involve clicks or press they shouldn't have the random fails.

I added todo's remove these when #2830485 is fixed

Status: Needs review » Needs work

The last submitted patch, 31: 2784567-31.patch, failed testing.

tedbow’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new2.84 KB
new825 bytes
new6.08 KB

face palm statue
Whoops my bad. fixed patch

tkoleary’s picture

Issue tags: -Dublin2016 +Usability, +sprint
kiwimind’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -80,6 +80,16 @@ public function testBlocks() {
    +      /** @var \Behat\Mink\Element\NodeElement[] $links */
    

    Should this be commented using the // format? I realise this is ok, but discouraged according to https://www.drupal.org/node/1354#inline

  2. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -80,6 +80,16 @@ public function testBlocks() {
    +        self::assertEquals('Quick edit', $links[0]->getText(), "Expected 'Quick edit' to be the first contextrual link of the block with id {$block['id']}, but it wasn't.");
    

    Typo s/contextrual/contextual

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new2.83 KB
new1.08 KB

@kiwimind thanks for the review!
re 1.
I think this is standard for comments that are type hinting a var using @var. If you search for "/** @var" in core it is pretty universal.

2. Fixed

tkoleary’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed 1

xjm’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/outside_in/outside_in.module
    @@ -34,6 +34,12 @@ function outside_in_help($route_name, RouteMatchInterface $route_match) {
    +    // Place outside in link first.
    

    The module name should either be Settings Tray or outside_in, I think.

  2. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -80,6 +80,16 @@ public function testBlocks() {
    +      // @todo: Remove if wait is not needed after https://www.drupal.org/node/2830485 is resolved.
    ...
    +      // @todo: Skip rest of test. Remove when https://www.drupal.org/node/2830485 is resolved.
    

    These don't follow our coding standards. The comments need to wrap at 80 characters. There also should not be a colon after @todo.

  3. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -80,6 +80,16 @@ public function testBlocks() {
    +      continue;
    
    @@ -136,6 +147,8 @@ public function testBlocks() {
    +    $this->markTestIncomplete('Test incomplete due to random failures in DrupalCI, see https://www.drupal.org/node/2830485');
    

    Isn't the test already skipped earlier, so this test is still not running? We would need to remove the hunk marking it as skipped also, no?

    Can we re-upload a test-only patch to prove the coverage?

    Also, super-nitpick, but this message contains a comma splice, and I think we can remove the words "in DrupalCI".

Thanks!

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new2.42 KB
new3.27 KB
new3.03 KB

@xjm thanks
1. fixed
2. fixed
3. You are right. My intention in #31 was to remove skip and replace with markTestIncomplete. The idea is we don't need to skip the entire test.
I forgot remove the skip.

Uploaded a TEST_ONLY
"super-nitpick". Super fixed

20th’s picture

Status: Needs review » Needs work

Aaand.. the blocking issue #2830485: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly is in. @tedbow, we can move back to simpler patch now, I guess.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new1.92 KB
new1.07 KB

@20th thanks for reviving this issue!

Yes here is patch that is just re-roll of your patch from #30
It also includes

  • fix for #38.1 change to machine name(the rest of #38 review doesn't apply because not skipping test anymore.
  • fix for #35.2 spelling fix

Also uploading a test only patch.
Since this was RTBC at #37 I think we should be good.

tedbow’s picture

StatusFileSize
new1.92 KB
new760 bytes

Actually I hadn't committed the machine name fix for #38.1. Fixed

The last submitted patch, 41: 2784567-41-TEST_ONLY.patch, failed testing.

20th’s picture

@tebbow
Maybe it would be better to remove the top blank line added between the 'if' and the comment by:

  */
 function outside_in_contextual_links_view_alter(&$element, $items) {
   if (isset($element['#links']['outside-inblock-configure'])) {
+
+    // Place outside_in link first.
+    $outside_in_link = $element['#links']['outside-inblock-configure'];
+    unset($element['#links']['outside-inblock-configure']);
+    $element['#links'] = ['outside-inblock-configure' => $outside_in_link] + $element['#links'];
+
     $element['#links']['outside-inblock-configure']['attributes'] = [
       'class' => ['use-ajax'],
       'data-dialog-type' => 'dialog',

It is not needed there, I think.

And before someone else pointed this, can you reupload both patch and test-only patch in the same comment to make it easier to find the correct one?

Otherwise, the patch looks good, but because I have worked on it as well, I shouldn't be changing it to RTBC.

tedbow’s picture

StatusFileSize
new1.07 KB
new1.92 KB
new630 bytes

OK removed the empty line. also uploaded TEST_ONLY patch

The last submitted patch, 45: 2784567-45-TEST_ONLY.patch, failed testing.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dmsmidt’s picture

Version: 8.3.x-dev » 8.4.x-dev
Issue tags: +DevDaysSeville
Related issues: +#2784569: Settings Tray Accessibility: Improve tabbing
StatusFileSize
new1.95 KB

This came up again at the dev days in Seville while reviewing #2784569-7: Settings Tray Accessibility: Improve tabbing.
I consider the approach in this issue actually as a quick fix, we could make the edit mode even more accessible (see linked comment).
I was only able to test this after a re-roll. Patch attached.

Woop, it works!

To be able to test this you need to clear you session/local storage after applying the patch.

dmsmidt’s picture

Status: Needs review » Reviewed & tested by the community

All previously open issues with this patch are resolved.
Since the current strategy has already been RTBC-ed before and it still works for 8.4.x we can safely RTBC this again.

dbjpanda’s picture

@dmsmidt Thanks for the patch. I tested it. And it is working for me. changing status to RTBC.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
@@ -73,6 +73,11 @@ public function testBlocks($block_id, $new_page_text, $element_selector, $label_
+    if (count($links) > 1) {

This isn't really needed and could cause the test to break in future

dbjpanda’s picture

Status: Needs work » Needs review
StatusFileSize
new1.74 KB

Deleted if (count($links) > 1) { } as per #51

tedbow’s picture

StatusFileSize
new3.5 KB
new3 KB
+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
@@ -73,6 +73,8 @@ public function testBlocks($block_id, $new_page_text, $element_selector, $label_
+    /** @var \Behat\Mink\Element\NodeElement[] $links */
+    $links = $this->getSession()->getPage()->findAll('css', "{$block_selector} .contextual-links li a");

This doesn't actually test anything if the assert calls is removed.

Changing the test check that "Quick Edit" is the first link and it point to the correct href(to not be confused with block_content link in the future)
Had to update providerTestBlocks() to send the real block id so the href is easier to test.

Status: Needs review » Needs work

The last submitted patch, 53: 2784567-53.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new1.02 KB
new3.17 KB

Forgot the href won't be exact match because of DrupalCI sub directory

Status: Needs review » Needs work

The last submitted patch, 55: 2784567-55.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new983 bytes
new3.76 KB

Test fix because a switch statement in \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testBlocks was not updated for the new value of the $block_id parameter.

GrandmaGlassesRopeMan’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 57: 2784567-57.patch, failed testing.

GrandmaGlassesRopeMan’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 57: 2784567-57.patch, failed testing.

dmsmidt’s picture

Status: Needs work » Reviewed & tested by the community
GrandmaGlassesRopeMan’s picture

So, no more CI errors?

  • lauriii committed 0707a70 on 8.4.x
    Issue #2784567 by tedbow, 20th, dmsmidt, miteshmap, dbjpanda, bendev,...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Looks good in overall. Thanks for adding the test coverage for this. Committed 0707a70 and pushed to 8.4.x.

tedbow’s picture

Issue tags: -Novice +Needs backport to 8.3.x

@lauriii thanks for committing this! It seems it is big accessibility improvement re: #48

Also I think this can be backported to 8.3.x because this an experimental module we have been able to keep the module exactly the same for 8.3.x and 8.4.x.

lauriii’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Fixed » Patch (to be ported)

Good point @tedbow. Marking for review from another committer.

tedbow’s picture

@lauriii alright thanks

I started #57 testing against 8.3.x so we can confirm it applies and passes.

star-szr’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Yup, let's commit to 8.3.x as well since it's an experimental module :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 57: 2784567-57.patch, failed testing.

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

It looks to me like DrupalCI marks this as Needs Work because #57 doesn't apply to 8.4.x which it was already committed to.
#57 was also tested against 8.3.x so marking as RTBC again.

  • lauriii committed 6d1b62d on 8.3.x
    Issue #2784567 by tedbow, 20th, dmsmidt, miteshmap, dbjpanda, bendev,...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs backport to 8.3.x

Cherry picked 6d1b62d and pushed to 8.3.x.

tedbow’s picture

@lauriii Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tedbow’s picture

Component: outside_in.module » settings_tray.module

Changing to new settings_tray.module component. @drpal thanks for script help! :)