Problem/Motivation

Right sidebar containing place block was not seen.

During usability testing, there wasn't a single participant who was able to successfully place an existing block. The right sidebar is dead to them. They're taught this both from the new add content page, but also from the entire internet at large, where the right sidebar is mostly either supplementary links or ads (aka, "ignore this").

Typically, participants would start by 1) scanning the massive table below (some looking for an add button/link in the region table rows), 2) going to the Add block button looking for a way to add dynamic block content from there, and finally 3) hitting the "Custom block library" tab:

Custom block library, containing just an empty table.

However, this was not helpful either, because it's actually a list of only your custom blocks, *not* a "library" of anything. I think the quote from one participant was something like, "Custom block library listing, now we're talking! ...Wait. I thought you said you had a block library?!"

I know we typically do not make UX problems critical, but IMO this one is. It's a primary interaction of a primary site builder UI and it represents a significant regression from D7.

Proposed resolution

Several approaches to fixing this have been debated and worked on at various points in the issue's life cycle.

The original proposed resolution (in #17, reflected in the patch at #207) consisted of removing the sidebar, moving the block library to its own page, and making "Place block" the primary action on admin/structure/block page, moving "Add custom block" to a sub-tab.

However, there were concerns raised that:

  • It moves the block “placement” further away from the blocks layout page, which was an important goal and achievement of the sidebar design.
  • It still leaves people looking at the region and then going back to “add action” to place it, versus putting the "add action" where it's more contextually relevant (on the region itself).
  • The custom blocks add interaction becomes much more buried, making it harder to discover.

To address these concerns, a new proposed resolution was brainstormed in #210 by @tim.plunkett (Block system maintainer), @Bojhan (UX maintainer), and @webchick (Product manager):

Mockup 1: Remove the sidebar, in favour of a "Place block" button in each region's table row.
Styled after the Views UI's similarly contextual "Add" buttons.

Also remove "Add custom block" as the primary action on this page. (In #2513580: [Regression] Demonstrate block regions link in Block layout should be visible even if help module is not enabled we can make "Demonstrate block regions" the primary action instead.)

Add 'place block' buttons to each region header

Mockup 2: When clicked, open a modal with the block listing that's currently in the sidebar
...and put the "Add custom block" action button at the top of this page instead.

Add custom block goes on top of the list of existing blocks

  • Please pretend this is in modal, and the primary tabs/breadcrumbs are not present.
  • Also, the buttons next to each row should say "Place block" vs. "Add block" to eliminate confusion.

Then, after choosing a block, you get the next modal with block configuration (region should be pre-populated).

Remaining tasks

Code it!

User interface changes

The stuff in proposed resolution.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#263 Screen Shot 2015-07-10 at 9.47.57 AM.png69.19 KBwebchick
#259 Block layout | Drupal-2015-07-10.png83.53 KBtim.plunkett
#259 interdiff.txt421 bytestim.plunkett
#259 2512456-block-259.patch41.41 KBtim.plunkett
#252 interdiff.txt12.68 KBtim.plunkett
#252 2512456-block-251.patch41.3 KBtim.plunkett
#249 placing-block.mp41.38 MBManjit.Singh
#249 error_block.png152.86 KBManjit.Singh
#242 interdiff.txt906 bytesdawehner
#242 2512456-242.patch39.33 KBdawehner
#236 block-links.png58.16 KBandypost
#236 block-links.patch38.3 KBandypost
#236 interdiff.txt4.69 KBandypost
#234 interdiff.txt1.62 KBtim.plunkett
#234 2512456-block-234.patch38.45 KBtim.plunkett
#229 2512456-block-227.patch37.77 KBtim.plunkett
#229 Block layout | Drupal-2015-07-09.png92.23 KBtim.plunkett
#226 block_layout_modal.png103.32 KBtim.plunkett
#226 block_layout.png90.82 KBtim.plunkett
#226 interdiff.txt763 bytestim.plunkett
#226 2512456-block-225.patch35.96 KBtim.plunkett
#223 2512456-block-222.patch35.21 KBtim.plunkett
#223 interdiff.txt42.09 KBtim.plunkett
#207 2512456-block-207.patch58.19 KBtim.plunkett
#202 Screenshot 2015-07-08 12.35.14.png51.83 KBlarowlan
#202 Screenshot 2015-07-08 12.31.41.png61.63 KBlarowlan
#198 2512456-block-198.patch56.11 KBtim.plunkett
#198 interdiff.txt1.75 KBtim.plunkett
#195 interdiff.txt20.19 KBtim.plunkett
#195 interdiff-test-fix.txt1004 bytestim.plunkett
#195 2512456-block-195-PASS.patch56.11 KBtim.plunkett
#195 2512456-block-195-FAIL.patch56.04 KBtim.plunkett
#190 2512456-breadcrumb-naming.png5.98 KBMattA
#186 2512456-block-186.patch52.75 KBtim.plunkett
#186 interdiff.txt8.76 KBtim.plunkett
#182 interdiff.txt603 bytesgoogletorp
#182 implement_the_new_block-2512456-182.patch54.17 KBgoogletorp
#181 interdiff.txt27.87 KBdawehner
#181 2512456-181.patch53.99 KBdawehner
#170 2512456-168-170-interdiff.txt448 byteslegolasbo
#170 regression_users_were-2512456-170.patch58.37 KBlegolasbo
#168 2512456-167-168-interdiff.txt16.05 KBlegolasbo
#168 regression_users_were-2512456-168.patch58.21 KBlegolasbo
#168 breadcrumb3.jpg16.31 KBlegolasbo
#168 breadcrumb2.jpg19.79 KBlegolasbo
#168 breadcrumb1.jpg13.23 KBlegolasbo
#167 2512456-165-167-interdiff.txt885 byteslegolasbo
#167 regression_users_were-2512456-167.patch55.96 KBlegolasbo
#165 2512456-140-165-interdiff.txt4.44 KBMattA
#165 2512456-165.patch55.93 KBMattA
#157 drupal8_-_2015-07-05_10.43.56.png2.83 KBbill richardson
#140 2512456-136-140-interdiff.txt1.93 KBMattA
#140 2512456-140.patch54.96 KBMattA
#136 2512456-119-136-interdiff.txt3.96 KBMattA
#136 2512456-136.patch54.96 KBMattA
#132 2512456-119-132-interdiff.txt10.03 KBlegolasbo
#132 regression_users_were-2512456-132.patch55.19 KBlegolasbo
#131 2512456-breadcrumbs-do-not-test.patch3.2 KBMattA
#125 Screen Shot 2015-07-03 at 14.45.16.png56.23 KBBojhan
#119 2512456-108-119-interdiff.txt1.68 KBlegolasbo
#119 regression_users_were-2512456-119.patch53.91 KBlegolasbo
#108 2512456-107-108-interdiff.txt6.45 KBlegolasbo
#108 regression_users_were-2512456-108.patch53.72 KBlegolasbo
#107 implement_the_new_block-2512456-107.patch52.03 KBgoogletorp
#107 interdiff.txt3.75 KBgoogletorp
#104 2512456-102-103-interdiff.txt698 bytesMattA
#104 2512456-103.patch51.77 KBMattA
#102 2512456-84-102-interdiff.txt15.45 KBMattA
#102 2512456-102.patch51.78 KBMattA
#88 regression_users_were-2512456-87.patch46.69 KBlegolasbo
#88 interdiff-84-87.txt11.83 KBlegolasbo
#88 I can only add existing blocks.png38 KBlegolasbo
#84 interdiff-82-84.txt4.52 KBlegolasbo
#84 regression_users_were-2512456-84.patch35.25 KBlegolasbo
#82 regression_users_were-2512456-82.patch32.78 KBlegolasbo
#82 interdiff-81-82.txt1.05 KBlegolasbo
#81 regression_users_were-2512456-81.patch32.48 KBlegolasbo
#81 interdiff-71-81.txt6.32 KBlegolasbo
#71 interdiff-2512456-62-71.txt18.54 KBMattA
#71 2512456-71.patch32.37 KBMattA
#66 Screen Shot 2015-07-01 at 15.32.40.png139.16 KBlegolasbo
#64 2512456-action-buttons.png9.74 KBMattA
#62 interdiff-44-62.txt8.66 KBlegolasbo
#62 regression_users_were-2512456-62.patch22.97 KBlegolasbo
#55 2512456-55-header-links.patch19.36 KBMattA
#54 2512456-functional-theme-demo.png4.09 KBMattA
#54 2512456-header-buttons.png32.13 KBMattA
#49 2512456-49.patch16.49 KBdarol100
#44 2512456-44.patch15.54 KBMattA
#43 2512456-43.patch13.67 KBMattA
#41 2512456-with-sorting.patch28.11 KBMattA
#41 2512456.patch26.43 KBMattA
#31 regression_users_were-2512456-31.patch22.62 KBlegolasbo
#31 interdiff.txt2.13 KBlegolasbo
#21 step4.png88.1 KBlegolasbo
#21 step3.png87.43 KBlegolasbo
#21 step2.png59.51 KBlegolasbo
#21 step1.png86.67 KBlegolasbo
#21 interdiff.txt14.32 KBlegolasbo
#21 regression_users_were-2512456-21.patch21.41 KBlegolasbo
#19 regression_users_were-2512456-18.patch8.17 KBlegolasbo
#17 block-types-typed.png147.83 KBBojhan
#17 block-types-list.png147.01 KBBojhan
#17 configure-block.png189.08 KBBojhan
#17 block-layout.png215.57 KBBojhan
#17 place-block.png207.65 KBBojhan
#16 2512456-block-layout.jpg158.28 KBMattA
#6 Screen Shot 2015-06-25 at 11.03.52 PM.png64.63 KBwebchick
#1 blockssidebar.png48.46 KBdavidhernandez
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidhernandez’s picture

FileSize
48.46 KB

To be clear, we are talking about this thing, right?

webchick’s picture

That's the one!

pwolanin’s picture

If nothing else the wording is quite bad - a block instance is being created, not placed? The blocks in the center already exist and can be placed?

There is also a tab for the custom block library at the top. More WTF.

webchick’s picture

What's interesting is they did at least find that tab, though it was usually the third thing they tried, after trying to make sense of the massive table below and then going to the Add block button. However, when you go there, it just contains a table that is totally empty. This is because it's actually a list of only your custom blocks, *not* a "library" of anything. I think the quote from one participant was something like, "Custom block library listing, now we're talking! ...Wait. I thought you said you had a block library?!"

tim.plunkett’s picture

The first half of #2078601: Move the block placement browser to the left of table and collapse it would make it more obvious, but collapsing it probably won't help.

webchick’s picture

Further fleshing out issue summary. I was originally going to split off the block library one to a separate issue but it's quite related to the one here.

webchick’s picture

Issue summary: View changes

Ah, thanks, adding that one too.

Bojhan’s picture

Title: [Regression] The idea that there is an existing library of blocks was completely lost on users » [Regression] Users were unable to figure out how to place a block
Assigned: Unassigned » Bojhan
Issue summary: View changes

Adding a bit of context. The core of the issue is that all of our users in the UMN 2015 test had significant difficulties in placing just a block. Since this is a key site building concept, that users had no difficulty with before - we are making this critical. UX issues such as this should be marked critical, as it severely hinders new and existing adoption of Drupal 8.

We identified several possible solutions. I will pick up and do some design exploration, I think there are multiple avenues to this. We need to ensure that, the time we put in is towards the most valuable one. I think either 2) or 3) would be most fruitful. While 1) is an option, I think the fact that it is considered supplementary will make people just go to the right side.

dawehner’s picture

My quick thought, why don't we just add it also an explicit step to add blocks. This allows to explain users what is going on, which is IMHO of a higher value than making things easy.

1) sounds just like a workaround to be honest. 2) Seems to be the solution which is more common with the entirety of the Drupal UI. If you add something you have an add button

dawehner’s picture

-

philsward’s picture

If it were me, I'd just add a third tab, placing it before the custom block tab, and call it something like "dynamic block library" or maybe "persistent block library". Verbage that denotes it as being a bit more static as opposed to being custom. Use the two library pages to enable/ disable which blocks are placed.

On a side note, "layout" should be renamed IMO. Layout is usually what happens after the item is placed. Rename it to "block placement"? Ideally you are placing the block on the page. It would fit the current verbage of placing the block. What happens when you throw panels or display suite into the mix which completely overrides all predefined themes? You now have block layout through core and layout through panels. To me, layout makes more sense when using a system like panels or DS. From a core standpoint, core doesn't (currently) handle the layout of anything. It simply regurgitates what it's told.

Installed on simplytestme and didn't even see the placement options until I scrolled to the very bottom of the region list. Lots of scrolling on mobile.

davidhernandez’s picture

Just want to say that I'm really glad this is being address. When I first tried Drupal 8, this was the biggest WTF for me. I took quite a while to figure out how the block administration worked. In the list of proposed solutions, #2 sounds the best. It falls in line with how fields are added. You click an "add" button and the choose new or existing.

dawehner’s picture

Yeah special case UIs are local optimizations which doesn't help you to find necessarily the global optimum.

cilefen’s picture

Why don't we call that thing the "Block Library"?

Fabianx’s picture

I agree with third tab, I myself just recently searched how to place a block myself ...

Block Placement | Block Library | Custom Blocks

MattA’s picture

FileSize
158.28 KB

Preview of moving the sidebar to the left:
Left sidebar with alternate labels

My suggestions:

  1. Move the sidebar to the left. It drastically improves visibility.
  2. Rename the sidebar header to "Add block". This makes it clear, where to go to add more blocks. This also necessitates a rename of the blue button to "Create custom block" which further emphasizes that it will not add an existing block to the site layout.
  3. Yes, rename that custom block library tab. No where else do we use "library" for a simple overview page. This should not be an exception.
  4. This may be a little controversial, but also recolor the sidebar. As a user of Drupal 6 and 7, my initial reaction to the new block page was to first scroll to the bottom and drag a block from the disabled section up, and second to try and click the blue button. It didn't initially dawn on me to check the right sidebar because it looked grey, which meant "useless disabled form elements" in my mind. The image makes that area white, which clearly means active (being bright also commands your eye's attention to look here).
Bojhan’s picture

Thanks Matt. Moving the sidebar over was also our first thought - as you throw it right in there face (hopefully). One of the things that does though - is creates a unique pattern to the blocks page (as we don't do this elsewhere). One of the things we noticed is that users are very attracted to the table of drag-and-drop.We fear that simply moving it, doesn't really solve the core of the problem.

We discussed this over the spriting at DrupalCamp Minneapolis (Webchick, Lewis, Ivan et al.). The solution to this problem is quite tricky, and there are very different ways to solving this.

From an interaction design perspective we wish to reduce the confusion by:

  • Avoiding two competing primary interactions on the block layout page (placing blocks and creating custom blocks)
  • Reducing the emphasis on custom blocks
  • Providing a highly useable place block interaction

Users were unable to achieve this task because they did not see the sidebar. Users ventured into custom blocks without realising the fact that there are existing blocks that can be placed.

To achieve this we think the best way to tackle this is to take the following actions:

  1. Remove the sidebar from the blocks layout page
  2. Make "place blocks" use our standardised UI pattern of having the primary action at the top of the page
  3. Allow all blocks (custom, module provided, etc.) to be placed via this "place blocks" page that follows the action
  4. Separate the creation of custom blocks and custom block types to a separate page.

While this seems rather radical, this critical problem truly prevented people from learning a core concept of Drupal. While we can try various visual tricks - we ought to really streamline this experience with the rest of core.

The challenges we see are mostly in using the correct labeling and descriptions to describe the concepts. Key here is that users are not tempted into custom blocks, simply as a "more" pattern - but rather knowning its purpose. We have learned that venturing into the custom blocks interface, can be misleading them into thinking there are no other blocks.

Mockup 1: Only provide one "place" interaction on the block layout

Mockup 2: Allow users to select all kind of blocks (module provided, custom)

Mockup 3: Provide users with the block configuration page

Mockup 4: Provide a separate page, from where you can add the custom blocks (same as now, different labels)

Mockup 5: Provide a separate page from, where you can add block types (same as now, different labels)

I would love to know what you think, this is quite a tricky problem - in a space that we had much bigger plans for. However we now need to move forward to release, and this critical building block should be highly usable.

Bojhan’s picture

Assigned: Bojhan » Unassigned
Status: Active » Needs review
legolasbo’s picture

Assigned: Unassigned » legolasbo
Status: Needs review » Needs work
FileSize
8.17 KB

Since the overall consensus (2hours ago) seems to be in favour of option 2, I've started work on an implementation of said option.
Attached you'll find an initial path which removes the block placement bar and moves it to a separate page. I'll continue working on this to match @Bojhan's mockups.

MattA’s picture

Hmm... Well let's start with the mockups:

Mockup 1:
Has a major issue of no obvious way to let users create a new block. First thought was definitely not to look in the "block types" tab. As you mentioned, labeling is so important! It also has that "classic" layout. Previous Drupal users are going to expect disabled blocks at the bottom - are we keeping that section?

Mockup 2:
Well it works. If that button creates a modal dialog, it's fine, but if not it should really be a select list.

Mockup 3:
Not different from what we already have, but... "UGH. I have to visit that form for every block I want to move? No #@$%ing way." ...was my initial thought if it became required to moving blocks around.

Mockup 4/5:
Don't mind. Same as #1 for that tab label though.

The more that I think about it, the more I think that we might also be missing the obvious solution. What if we placed disabled blocks into "default" sections of the table right next to active blocks that would be greyed out and have an "enable" link? If that link was ajax-ified and worked like the edit field gear icon, and then allowed in-place configuration... could be promising. It might require changes to the block plugin system though.

Also, personally, I group blocks and themes together in my head for whatever reason. Like the theme page, I kind of expect a slightly unique UI/appearance on the block page. What if block layout was a child of the appearance menu? Would people be more willing to deal with a custom UI and let us get away with different concepts?

legolasbo’s picture

Issue summary: View changes
FileSize
21.41 KB
14.32 KB
86.67 KB
59.51 KB
87.43 KB
88.1 KB

I'm using the mockups as a general guideline since I already anticipated disagreements on certain elements (such as Mockup1's tab label). Attached you'll find a new patch + interdiff + screenshots of the current add block workflow.

New block layout page.
I've chosen to rename the Block library tab to be Custom blocks because that's what the tab actually is, a way into custom block management. However, I feel this tab might actually be misplaced here.
Block layout page

New block placement page.
This is currently just the original sidebar, but moved to a seperate page. Will refactor this to more closely match the other admin screens.
New block placement page

Placement of a block. AJAX goodness
Nothing has changed here, Clicking one of the blocks will open a modal.
AJAX modal

Submitting the modal adds the block and returns the user to the block layout page.
Return to layout page

MattA’s picture

Here's a preview of my thoughts in #20:
Only local images are allowed.

This way blocks are nice and visible right there in the main table, instead of buried at the bottom, if that's what we're going for. They can also be immediately enabled and set in the user's desired region, with ajax changing the link to a "configure" button. There's just that pesky issue of implementation...

Also, yes to getting rid of the regions column. It is redundant information and at odds with the concept of a draggable table.

legolasbo’s picture

@MattA,

how does your proposition handle adding multiple instances of the same block? I'm afraid the list of uninstantiated blocks will clutter the block layout overview.

Personally I think separating the block placement from the block layout tremendously cleans up the admin UI at the cost of 1 extra click. Therefor i think option 2 is the best way to solve this issue.

legolasbo’s picture

legolasbo’s picture

Issue summary: View changes

Removed accidentally embedded images.

MattA’s picture

It doesn't, so scratch that idea. Ironically enough, I had removed the sidebar while working on the concept and forgot about that feature. /sigh

MattA’s picture

On a side note: how about "add block to layout" instead of "place block" to keep with standards?

dawehner’s picture

@legolasbo
It is great to see progress here.

In general I think being able to search might still makes sense on that additional page. Do you think it should be part of a modal as well? The views UI has a similar pattern when you add a new field for example.

LewisNyman’s picture

There is already a separate issue: #2513534: Remove the 'disabled' region from Block UI

I think we should be able to keep these two patches separate, which would reduce the complexity of this issue.

Bojhan’s picture

@dawehner Yhea, I'd love if we can retain that. I didn't want to assume that we can easily paste it over though - if we can that'd be great.

legolasbo’s picture

Another update. The block placement page now actually respects the chosen theme in stead of just placing blocks on the default theme.

@dawehner I was also thinking that the search feature should be retained. As for placing the actual block placement form in a modal... I didn't quite think of that option, but that would be a great way to keep users informed of the context of the form. However, for now I'll focus on actually implementing the proposed resolution. We can always add the modal in a follow-up issue.

dawehner’s picture

@dawehner I was also thinking that the search feature should be retained. As for placing the actual block placement form in a modal... I didn't quite think of that option, but that would be a great way to keep users informed of the context of the form. However, for now I'll focus on actually implementing the proposed resolution. We can always add the modal in a follow-up issue.

Totally agree. I was just thinking out load.

@legolasbo++

StuartJNCC’s picture

One thing that has caught me out a few times when I have looked at this screen is that the items in the "Place blocks" list are prefixed with "+". In Drupal, that usually means you can drag and drop them - e.g. rearrange the order of items in a list. So, several times I have come to this screen and tried to drag a block from the "Place blocks" list and drop it in one of the screen regions on the left. Of course it doesn't work (wherever you drag it, it always has a "no entry sign" cursor) and hence evokes a momentary WTF? reaction.

When I think about it, I realise that the "+" in this context denotes an expanding/collapsing hierarchical list. But drag and drop does seem the natural way to go about it here.

Why not a drag and drop interface?

davidhernandez’s picture

+1 regarding what StuartJNCC sad. The first time I used Drupal 8 that is exactly what I tried to do with the "+".

MattA’s picture

@StuartJNCC Yup, I've done that... as recently as today...

As mentioned in #17 from a usability perspective, keeping things consistent leads to people knowing what to do, generally speaking. So creating a sidebar that people may or may not see, and then adding a drag-and-drop behavior that isn't implied, mentioned, or used elsewhere in core isn't ideal.

@legolasbo Nice work so far. Just some nitpicking:
Should probably make the path: admin/structure/block/placement.
The "Add custom block" action on that page probably isn't necessary/optimal.
It might be better to also use the theme local task on that page too.

webchick’s picture

#33/#34 are super interesting observations. Could you spin off a separate issue for them (against Seven theme)? I don't want to really touch styling as part of this since it's complex enough already.

And wow, @legolasbo++! So wonderful to see work being done on this already!!

legolasbo’s picture

Assigned: legolasbo » Unassigned

@MattA,

I agree with the nitpicks and will incorporate them.

For now I've gotten a little stuck, which is probably caused by working on this for too long. I'll continue work on this on thursday. Unassigning the issue in case someone else wants to pick up work on this in the mean time.

rickvug’s picture

There is a lot of space beside each region title (Header, Primary Menu, Secondary Menu, Help, Highlighted). What about a "add block" link directly beside these titles? From there open up a modal to select the specific block or add another. My gut (needs to be validated) is that users think layout first when wanting to add a new block to a page.

Fabianx’s picture

#34: Yes, count me into the users that tried to drag and drop the blocks ...

webchick’s picture

#38 is a great suggestion, and another issue that was identified during this round of UX testing. #2513528: Add a link to add a block in empty regions on the Block layout page.

MattA’s picture

FileSize
26.43 KB
28.11 KB

Took a fresh stab at this just to get more familiar with Drupal...

@todo
- Tests. Duh.
- Add/remove/edit help text.
- Thoroughly review the javascript, I haven't written code in that language in years...
- I might need to reinstall, but the Custom blocks page title disappears after the first time viewing it?!?!
- There's quite a bit of unused CSS laying around now.
- The grey modal background doesn't play nice with sticky headers.

legolasbo’s picture

@MattA,

I wanted to take a look at your patch to see which direction you are taking, but unfortunately it failed to apply.

MattA’s picture

FileSize
13.67 KB

Hmm... ok, tried it myself, and after some quick Google-ing it seems PowerShell messes up the encoding. Seems it output in UTF-16?! That would definitely explain the large file sizes of my last couple patches...

Let's try this again, not in Windows this time. :D

MattA’s picture

FileSize
15.54 KB

Nope, missed the new files. /sigh

Manjit.Singh’s picture

Status: Needs work » Needs review
darol100’s picture

Status: Needs work » Needs review
FileSize
16.49 KB

I'm not sure why the automatic testing is falling. However, I notice that patch from #44 have a lot trailing whitespace. So here is an updated version of #44 without those trailing whitespace.

tkoleary’s picture

Posted this design over on #2513528: Add a link to add a block in empty regions on the Block layout page. the block list expanding is a related but additional to that issue.

Only local images are allowed.

tkoleary’s picture

After looking at this for a while I think maybe the block list needs to be labeled with a verb to underscore the action required. But instead of "place blocks" I'd say "Choose a block"

LewisNyman’s picture

@tkoleary That's pretty cool! I feel safer if we went with a modal though, if we aren't aiming for a drag-and-drop interface in this release. A modal is impossible to miss :)

MattA’s picture

@LewisNyman Yes, modal is definitely the way to go if we do this. My current dev site has it, and it turns the whole process into a nice ajax wizard like effect. :)

There are quite a few options when it comes to adding header links though.
Links to add block in table header

Personally, I don't feel like any of them look great, but for now it is probably all we can do. I am more a fan of Plan B (preferably with drag & drop support and weight handles).

A demo that does something.

MattA’s picture

Here's a patch with the ajax goodness (went with option #3 just for simplicity).

legolasbo’s picture

Even though I like the idea of being able to add blocks to a region directly, I think this falls outside of the scope of this issue.

Let's focus on moving the sidebar to a separate page and address the direct block placement feature in #2513528: Add a link to add a block in empty regions on the Block layout page. after this issue lands.

Fabianx’s picture

#56: "Users were unable to figure out how to place a block" - I think the patches and screenshots give users easy ways to place a block?

legolasbo’s picture

Assigned: Unassigned » legolasbo

I'll work on the patch in #49 for a few hours to figure out why the tests are failing.

MattA’s picture

Yeah the more I use it, the more I feel that it just doesn't look right (the workflow is so much better though!). Oh... and the table sorting doesn't work in a modal dialog. I don't even know where to begin debugging that issue though, so just going with #44 and saving that for a follow-up sounds like a good plan for now.

LewisNyman’s picture

Please do try and keep the patches as simple as possible but keeping solutions to their separate issues. It get's harder to review a patch if it introduces loads of changes.

We already have these two issues: #2513528: Add a link to add a block in empty regions on the Block layout page. #2513520: Add a contextual link to add a block to a region

legolasbo’s picture

I agree with @LewisNyman,

The changes in #44 already broke 67 assertions which need mending. Adding additional functionality would add further complexity to this already growing patch.

I'll upload a new patch which fixes several broken tests in a few minutes. There are still a few to go, but I'm running out of time for today.

legolasbo’s picture

Assigned: legolasbo » Unassigned
Status: Needs work » Needs review
FileSize
22.97 KB
8.66 KB

Attached patch fixes several tests which were broken in #44. I'll continue work on this tomorrow.

Details for each test are listed below:
Drupal\block\Tests\BlockLanguageCacheTest was failing because we moved the block listing. After changing the paths it passes again.

Drupal\block\Tests\BlockUiTest was failing because we moved the block listing and changed the listing to a table. After changing the paths and xpath queries it passes again.

Drupal\block\Tests\BlockXssTest was failing because we moved the block listing and changed the listing. Adjusted the test accordingly.

Drupal\block_content\Tests\BlockContentListTest was failing because of the changed content listing title. I’ve changed the test accordingly.

Drupal\block_content\Tests\BlockContentTypeTest was failing because it was testing if the user would be redirected to the block configuration form after a custom block was added from the block placement form. Removing the Add custom block button is actually a major regression because users would now have to follow the following path to add a new custom block to the layout:

  1. Click the custom blocks tab
  2. Add a custom block
  3. Return to block layout
  4. Click the Add block to layout action button
  5. Find their block
  6. Click the Add block operation button
  7. Configure the block

I’ve undone the removal of the Add custom block button and relabelled it to Add new custom block to layout. After which I've changed the paths in the tests to reflect the new block placement url.

MattA’s picture

FileSize
9.74 KB

Hmm, I still have strong reservations about bringing back the custom block action button. Specifically the thoughts mentioned in #17:

From an interaction design perspective we wish to reduce the confusion by:

  • Avoiding two competing primary interactions on the block layout page (placing blocks and creating custom blocks)
  • Reducing the emphasis on custom blocks
  • Providing a highly useable place block interaction

Here is the train of thought that I think new users will go through for each button:

  • For "Add block to layout" they won't know what existing blocks are available, so the decision to click won't be weighed very highly.
  • For "Add new custom block to layout" they won't know what a "custom block" is. To them it could include existing blocks. Combined with the low weight given to the primary button, it ends up being about 50/50.

One solution is to explain what a custom block is, and provide a link to create one in the help text instead. That way we can still emphasize our desired primary interaction. This also goes well with efforts in #2514150: Advertise the block region demonstration in a more prominent way. So we effectively switch the demo and custom block positions and end up with:

Future action buttons.

MattA’s picture

Issue tags: +Block UI overhaul
legolasbo’s picture

@MattA,

How about something like this?

Block listing local actions.

That would still allow the user to directly add a custom block, but still emphasises the desired primary action.

MattA’s picture

It's a nice visual aid, but no, I don't think it is enough.

Some thoughts:
a) Visual aids don't help the color blind, or in tree testing.
b) From a language perspective, the two combined are still bad. The word "new" does nothing to clarify the action, as that is what both buttons do. The word "custom" is just too ambiguous as well. There's just no way to do what we want in one word. Maybe two if we used something like "user-defined" instead, but even that just makes it technical. Mind you, given what actually happens, the button's verb is also wrong. It should really be more like "create and add
block to layout" (also, the '+' symbol which implies "add" is set by the theme, and can't be removed).
c) No where else in core is there a grey action button. Not sure if we should start a trend here.
d) Even if we wanted to, I've looked into the code, and it doesn't look like we can easily change the button color since it is apparently hard-coded into template_preprocess_menu_local_action() as $link ['localized_options']['set_active_class'] = TRUE.

MattA’s picture

e) Wait, why are we even discussing this! We're getting side-tracked. This issue should just be about making the block placement action obvious and moving the "custom blocks" link to a help text paragraph certainly does that (while not causing a total regression of the old custom block workflow). If we need to make it more prominent later then we can create a new issue and let some other guy worry about it.

legolasbo’s picture

@MattA,

Good point in e). let's move into that direction. Fixing/closing this critical should be our first priority. Removing the ability to create & place a custom block would introduce a new regression. Moving the link to do so however does not introduce said regression while still focussing on improving the block placement/layout workflow.

LewisNyman’s picture

Title: [Regression] Users were unable to figure out how to place a block » Implement the new block layout design to emphasize the primary interaction of placing a block
Issue summary: View changes

The current patch is looking great! Good to see so much progress so quickly.

I'm a little concerned that we're moving a little too fast for some with less time to keep up. @Bojhan has yet to respond the feedback to his designs. It's important that we get buy-in from the UX maintainers to make sure we are designing a consistent interaction with the rest of core and keeping other problems and concepts in mind.

At the sprint on Sunday we discussed some of the points that @MattA has raised in #20 and Bojhan's designs have already considered some of them. For example, the reason why the 'create custom block' button is hidden further down in the IA is because that button was extremely misleading

Could we please focus our time and energy in Bojhan's original designs for now? I think there are a few tweaks and improvements we can add to it, like adding the AJAX block settings and filtering, we should be very careful of overbaking the designs in one patch.

I've updated the issue summary with Bojhan's designs. Hopefully we can move forward with consensus.

MattA’s picture

Status: Needs work » Needs review
FileSize
32.37 KB
18.54 KB

Let's see how this goes...

Notes:

  • The old BlockXssTest used to check if block titles were sanitized in the old sidebar. So technically, the test could be removed. Right now it just tests the text on the table, which is probably unnecessary?
  • This patch does NOT contain an "add custom block" related section, because we need to decide how to output it. If placed in a help paragraph it would not show if the help module is disabled. It also shouldn't be provided by the block module, since it only applies if the block_content module is enabled. So basically, should the block_content module output as help text or should it alter block_admin_display_form?
  • Right now the block content test just checks if the theme query argument works, but if someone wants to make it actually follow a link again, be my guest.

Depending on how this turns out, our remaining tasks would be to:

  • Remove the now unused CSS from the sidebar.
  • Add the "custom block" paragraph and link.
dawehner’s picture

I gave #71 a try. It looks pretty great and works as expected for me. Looks like the minimal amount of changes here to get the critical issue fixed.
Great work so far!

  1. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,97 @@ public function listing($theme = NULL, Request $request = NULL) {
    +   */
    +  public function layout($theme) {
    +    $headers = [
    +      ['data' => t('Block'), 'field' => 'name', 'sort' => 'asc'],
    +      ['data' => t('Category'), 'field' => 'category'],
    +      ['data' => t('Operations')],
    +    ];
    +    $rows = [];
    +
    +    // Only add blocks which work without any available context.
    +    $definitions = $this->blockManager->getDefinitionsForContexts();
    +
    

    When manually testing the patch I thought it might be better to sort by category by default, so the behaviour is more similar to before ... Given that I am not sure whether its worth to be able to choose which click sort you want.

  2. +++ b/core/modules/block/src/Plugin/Menu/LocalAction/BlockLayoutAddLocalAction.php
    @@ -0,0 +1,37 @@
    +    // The default task is always the default theme since it is given a lower
    +    // weight. Therefore, it should always be the default action target.
    +    $theme = \Drupal::config('system.theme')->get('default');
    +    // The action target requires a {theme} parameter, but that parameter is
    +    // not set in the default task route, so it has to be manually provided.
    +    $route->setDefault('theme', $theme);
    

    Looks perfect for me

  3. +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
    @@ -60,19 +60,20 @@ public function testBlockCategory() {
     
    +    $pattern = '//tr[.//td/div[text()=:text] and .//td[text()=:category] and .//td/div/div/ul/li/a[contains(@href, :href)]]';
    +
    

    Wow, that xpath looks really detail, maybe we can figure out something better which also doesn't break too easy, in case the HTML would change. For example maybe it is enough to check for the a href with :href and nothing else.

  4. +++ b/core/modules/block_content/block_content.links.action.yml
    @@ -8,7 +8,5 @@ block_content_add_action:
       route_name: block_content.add_page
       title: 'Add custom block'
       appears_on:
    -    - block.admin_display
    -    - block.admin_display_theme
         - entity.block_content.collection
       class: \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
    

    Yeah its a good question whether just doing that would be enough, it seems that this could lead to another level of confusion, as its not trivial to find where to add a custom block.

The old BlockXssTest used to check if block titles were sanitized in the old sidebar. So technically, the test could be removed. Right now it just tests the text on the table, which is probably unnecessary?

Well I think there is some value in checking that the labels on the extra page are sanitized properly as well.

This patch does NOT contain an "add custom block" related section, because we need to decide how to output it. If placed in a help paragraph it would not show if the help module is disabled. It also shouldn't be provided by the block module, since it only applies if the block_content module is enabled. So basically, should the block_content module output as help text or should it alter block_admin_display_form?

Good question. In general yes, I think this should live in block_content</block>. Regarding <code>hook_help() vs. hook_form_alter()
I would lean towards the first approach, so you can disable help module, in case you don't need that.

lauriii’s picture

I tested the patch manually and it actually works better than the test fails let me expect ;) I guess most of the test fails are because web tests are failing to set blocks into regions.

Just a few nits from the patch but overall looks good.

  1. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,97 @@ public function listing($theme = NULL, Request $request = NULL) {
    +      ['data' => t('Block'), 'field' => 'name', 'sort' => 'asc'],
    +      ['data' => t('Category'), 'field' => 'category'],
    +      ['data' => t('Operations')],
    

    Maybe use $this->t instead

  2. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,97 @@ public function listing($theme = NULL, Request $request = NULL) {
    +   * @return array
    

    @return mixed[] is little bit more explicit

  3. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,97 @@ public function listing($theme = NULL, Request $request = NULL) {
    +      ['data' => t('Block'), 'field' => 'name', 'sort' => 'asc'],
    +      ['data' => t('Category'), 'field' => 'category'],
    +      ['data' => t('Operations')],
    ...
    +    if ($order['name'] == t('Category')) {
    ...
    +        'title' => t('Enter a part of the block name to filter by.'),
    ...
    +      '#empty' => t('No blocks available.'),
    

    Maybe use $this->t instead

  4. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,97 @@ public function listing($theme = NULL, Request $request = NULL) {
    +    if ($order['name'] == t('Category')) {
    

    This is a little bit odd. I don't know why it is like this but maybe it could be done some other way.

legolasbo queued 71: 2512456-71.patch for re-testing.

legolasbo’s picture

I Queued the patch for retesting to see which tests actually fail. I'll continue work on this 2 or 3 hours from now.

MattA’s picture

@dawehner
#3: The href is being used to make sure it's the right block since like 3 of them have the same name. The test also specifically changes the category so that part needs to be checked too. So as far as I can remember, only the text is optional.
#4: Before deciding, note that it is kind of similar to #2513580 in that a functional link should not be part of help text.

@legolasbo Looks like it was just the testbot. Greeeen! :)

+      $links['add'] = [
+        'title' => 'Add block',

This should be wrapped in t() though. Don't know how that even happened.

MattA’s picture

So I'm pretty sure this would work:
$pattern = '//tr[.//td[text()=:category] and .//td//a[contains(@href, :href)]]';
Don't know why I didn't just do that to begin with... should also let you remove the ':text' field from $arguments as well.

legolasbo’s picture

Assigned: Unassigned » legolasbo

Starting work on the notes in #73, #74 and #77

dasjo’s picture

Note that xano has written a "Plugin Selector" which aims to be a reusable solution (think views add dialog) for drupal 8:
https://www.drupal.org/project/plugin

Its probably out of scope to implement this here but as the current views add dialog implementation already lacks re-usability, I would like to propose that the mid-term solution should be something reusable. We'll need the same for adding rules configurations for #d8rules for example.

legolasbo’s picture

Status: Needs work » Needs review
FileSize
6.32 KB
32.48 KB

I've gone over the issues mentioned to start with a clean slate before further development and will continue with

Depending on how this turns out, our remaining tasks would be to:

Remove the now unused CSS from the sidebar.
Add the "custom block" paragraph and link.

Notes
#73-1 Category is now the default sort column.
#73-3 see #78 below.
#73-4

Well I think there is some value in checking that the labels on the extra page are sanitized properly as well.

This was my motivation to adjust the test instead of removing it.

#73-4 #77-4 We should discuss this further, but I don’t think the discussion should hinder the development of this patch since block placement is the main focus of this issue. In my opinion, the only thing we should discuss in this issue is if the removal of the option to add a new custom block from the block placement form is an acceptable regression or not.

#74-1 replaced all t() calls in BlockListController by $this->t()
#74-2

/**
 * Builds a listing of entities for the given entity type.
 *
 * @return array
 *   A render array as expected by drupal_render().
 */
public function render();

Is from EntityListBuilderInterface and also encountered at other methods returning a render array. It seems to be a convention to document returned render arrays as an array.

#74-3 see #74-1
#74-4 @lauriii Could you clarify what seems odd to you?

#77 Wrapped in $this->t()

#78 manually tested he xpath-query and it selects a unique and correct row. Adjusted the query accordingly.

legolasbo’s picture

FileSize
1.05 KB
32.78 KB

Oops

MattA’s picture

  1. Looks like a few instances of find & replace were missing the space between => and $this.
    -      '#placeholder' => t('Filter by block name'),
    +      '#placeholder' =>$this->t('Filter by block name'),
  2. Should use the xpath in #78.
legolasbo’s picture

FileSize
35.25 KB
4.52 KB

Fixed #83
Fixed my xpath mistake from #81 and #82 and this time waited for a green test locally ;)
Removed unused CSS from block.admin.css by first locating all pages where said file was used and then searching for selectors to see if the css rules still apply. Also added some comments to the remaining sections to clarify why they exist.

dawehner’s picture

Issue tags: +D8 Accelerate London

.

darol100’s picture

Status: Needs review » Needs work

Great work, but...

+++ b/core/modules/block/css/block.admin.css
@@ -21,88 +22,10 @@ a.block-demo-backlink:visited {
\ No newline at end of file

\ No newline at end of file

legolasbo’s picture

Status: Needs work » Needs review
FileSize
38 KB
11.83 KB
46.69 KB

While thinking about a good way to formulate the custom blocks help paragraph i encountered 2 things.

  1. There were still several mentions of the block library which is no longer a thing in this patch. I've changed said mentions to block listing in stead.
  2. The current state of this patch makes it really difficult to explain how to add a new custom block to a region. I'll explain why below.

Let's say i want to add a new block to the layout. My first instinct (even though i know I can't actually succeed that way) is to click "add block to layout". Which leads me to the new block placement page. That page only lists existing blocks and has no way to add new blocks nor does it offer an easy way to return to the regions listing as seen below.
I can only add existing blocks.

This means I have to go back to square one and follow the successful path where I first click the "custom blocks" tab. On the new page I see a listing of custom blocks and a "Add custom block" button which I click. I can then fill out a form to add a new block.
So far so good, but upon clicking "Save" I return to the custom block listing.

This means I have to click the "Block layout" tab (if I use blocks often and know that gets me to the right page). And then use the steps described above to add the block to the layout.

To me this seems like a lot of (confusing) work. Especially for inexperienced users. And I think it is impossible to write a short paragraph to describe these steps. Even if we were to manage to explain these steps in a short paragraph it would be something like this

"Do, this, that, that, and something else. Or click this link which is some magical shortcut because we removed the 'Add new custom block to layout' button"

Basically i see two options here:

  1. Reintroduce the 'Add new custom block to layout' button - low impact on the scope of this patch. At the expense of the primary action.
  2. Relocate the Custom blocks tab to the "Add block to layout" page and introduce a "Add custom block" local action there. - medium/high impact on the scope of this patch
legolasbo’s picture

Assigned: legolasbo » Unassigned

My preference goes towards option 1. I think we should limit the scope of this issue to the removal of the sidebar in favour of a new block placement page. We can still address the custom blocks in a follow up issue.

dawehner’s picture

Reintroduce the 'Add new custom block to layout' button - low impact on the scope of this patch. At the expense of the primary action.

This sounds fine for me ... we could even use destination here to redirect the user to the placement block page after adding the custom block.

legolasbo’s picture

@dawehner,

Thats what the original implementation did.

darol100’s picture

Reintroduce the 'Add new custom block to layout' button - low impact on the scope of this patch. At the expense of the primary action.

1+ like this idea, we should keep it simple for now, just like @LewisNyman mention in couple comments already.

mbrett5062’s picture

Instead of "Add custom block" for creating it, could we not rename that to "Create custom block"

So "Add" is used for placement, and "Create" is used for creation.

It seems a little less confusing.

I see this as Adding Blocks to the layout, including both supplied by core blocks and custom user created blocks.

Then you have the additional functionality of creating your own custom blocks for inclusion into the list of available blocks that can be added to the layout.

mbrett5062’s picture

Also maybe the block listing/placement page/tab could be subdivided. Showing all blocks, but on collapsible fields for "Core Blocks" "Module Blocks" "User Blocks"

dawehner’s picture

Good point @mbrett5062!
It explains really better about the underlying architecture.

Also maybe the block listing/placement page/tab could be subdivided. Showing all blocks, but on collapsible fields for "Core Blocks" "Module Blocks" "User Blocks"

Such conversations should happen in a follow up.

legolasbo’s picture

Issue summary: View changes

So, to summarise, remaining tasks:

  1. Restore the removed add custom block button, but name it "Create custom block" as suggested in #94
  2. Restore + adjust the removed tests relevant to the custom block button.

Possible follow up issues:

  • Separate block placement page into two or more collapsible fields for core/module provided and user blocks.
  • Relocate the "Custom blocks" tab to the block placement page.
  • Load the block placement page in a modal
lauriii’s picture

Issue tags: +Needs tests

This issue needs also new tests for the way block page works now

lauriii’s picture

Status: Needs review » Needs work

Good work on the issue everyone and thanks for the IS update! We have very nice progress here. Some comments of the patch we have right now:

  1. +++ b/core/modules/block/js/block.admin.js
    index aa669fa..643fcad 100644
    --- a/core/modules/block/src/BlockListBuilder.php
    
    +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -306,69 +304,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    -          'data-dialog-options' => Json::encode(array(
    

    After removing this use Drupal\Component\Serialization\Json; can be removed

  2. +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -306,69 +304,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    -        'url' => Url::fromRoute('block.admin_add', [
    

    After removing this use Drupal\Core\Url; can be removed too :)

  3. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,96 @@ public function listing($theme = NULL, Request $request = NULL) {
    +    $rows = [];
    

    Ubernitpick but can we move this variable declaration before the foreach so its explicit that its being populated there?

  4. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +61,96 @@ public function listing($theme = NULL, Request $request = NULL) {
    +    $build['filter'] = array(
    

    This could use the new array syntax

  5. +++ b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
    @@ -61,7 +61,7 @@ public function testBlockLinks() {
    +      $this->drupalGet('admin/structure/block/list/classy/add', array('language' => $langcode));
    
    @@ -72,7 +72,7 @@ public function testBlockLinks() {
    +      $this->drupalGet("admin/structure/block/list/classy/add", array('language' => $langcode));
    

    (optional) change to have new array syntax :)

legolasbo’s picture

Issue tags: -Needs tests

This issue needs also new tests for the way block page works now

It doesn't need new tests, because we've adjusted the tests according to the changes we've made. Unless you can pinpoint specific changes which are currently untested of course.

Bojhan’s picture

Thanks for bringing the scope back down to the original issue. That's really appreciated.

While the dialog interaction is nice - it is actually completely a hack. Views uses this pattern, but it has not consistently made its way throughout core. We added it to blocks, in the anticipation of rolling it out further - but never made it. I think for now we are safe to assume, that while its a nice pattern - we shouldn't pursue something that is half implemented across core.

Having a dialog in the block placement flow, makes little sense - you are not moving back to the page behind it. This should just be a normal page.

I understand the concerns with regards to adding a custom block. However I am adamant about not having two primary actions on the top of the page (just making the other gray, doesn't help). We have learned in testing Drupal 8 that having two action buttons is incredibly confusing, and this test again made it clear that people do not know what "adding a custom block" necessarily means. At best I would go for option 2) of adding it to the block placement page, however it is a bit of a break in the mental model. So I am not yet convinced.

MattA’s picture

Status: Needs work » Needs review
FileSize
51.78 KB
15.45 KB

Fixed a few help text issues:

  • and provides a <a href="!block-listing">Custom block listing</a> listing all of them.
  • Multiple occurrences to "Place block" from the old sidebar.
  • Other general cleanups.

Simplified some labels from "custom block listing" to just "custom blocks" where appropriate.
Updated with most of the changes from #99 (not #5).
Removed the ajax stuff as per #101.

@Bojhan I totally agree with not having another primary action, but I also don't think adding it to the new page we just created is the solution either. We might be stuck with just adding a sentence to the help text, but that's all for a separate issue...

MattA’s picture

FileSize
51.77 KB
698 bytes

Fixed that one test...

MattA’s picture

Status: Needs work » Needs review
legolasbo’s picture

@Bojhan, @MattA,

In your opinion, where does that leave us in regards to adding a custom block from this patch? I guess we'll just accept the regression for now?

Perhaps we should treat custom blocks as content in a same way the D7 bean module does. That would remove the tight coupling of the block and block_custom UI and possibly simplify maintenance. But that's a discussion for a follow up issue.

googletorp’s picture

Fixed some code style issues and ESLint validation of block.admin.js.

legolasbo’s picture

Changed array notation for code touched by this patch to use the shorthand notation for consistency and removed an unused use statement.

legolasbo’s picture

Issue summary: View changes
lauriii’s picture

Status: Needs review » Needs work

All the code we have in the patch looks sane and clean. We have still remaining task regarding the add custom block button which should be restored. Setting for NW to get that done.

legolasbo’s picture

Status: Needs work » Needs review

@lauriii,

This issue is about focussing the block layout page on it's primary task, which is the layout and placement of blocks. While creating and placing custom blocks has some relevance regarding this issue I think we should consider it out of scope for now.

We should open a follow-up issue (perhaps even a critical) to discuss and change the custom_block UI in general. Because besides this button, the "Custom blocks" tab also seems out of place here and when we start moving these things around, more issues will arise which would extend the scope even more. For now let's keep focussing on the changes at hand.

lauriii’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I'm sorry I missed #101. Updating the remaining tasks then.

This looks good in all terms for me so I'm setting this to RTBC.

Bojhan’s picture

Status: Reviewed & tested by the community » Needs review

Lets allow for some review.

lauriii’s picture

Just a clarification: all the custom block related discussions should happen in the follow-up. Right now there is no way to add custom blocks on the Block layout page but instead on the custom block library page.

googletorp’s picture

I'm generally happy with the code as well.

There are some small nitpicks that we could address, like

  1. +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
    @@ -51,7 +49,7 @@ public function testBlockCategory() {
    -    $edit = array();
    +    $edit = [];
    

    Conversion to new array syntax in related code.

  2. +++ b/core/modules/menu_ui/src/Tests/MenuTest.php
    @@ -181,7 +181,7 @@ function addCustomMenuCRUD() {
    -  function addCustomMenu() {
    +  protected function addCustomMenu() {
    

    Correctly use protected (or public) for class methods.

These changes are actually scope creep, not sure if this is a showstopper. The code is nice and clean like it is, but might be breaking a few policies.

MattA’s picture

Follow-up issue for the custom block module: #2523154: Improve workflow for creating custom blocks

MattA’s picture

+++ b/core/modules/block/js/block.admin.js
@@ -28,8 +28,8 @@
+         * @param {number} index The index of the block.
+         * @param {HTMLElement} label The label of the block.

Small nit, update the label description to: "The element containing the block name." Even with the type-hint, the description makes it sound like a string and I'm getting very tired with the poor (to put it nicely) documentation in core (mostly class properties that just restate the variable name instead of actually explaining what it is or what it is used for).

Also, might want to rename that function too since it doesn't just "show" rows.. it toggles them.

@googletorp Oh, you have no idea how hard I had to hold myself back from setting visibility modifiers on those... sadly, I determined that it probably was issue creep. :(

MattA’s picture

legolasbo’s picture

Fixed both nitpicks in #117 and a array notation i found because of #115-1.

In regard to #115-2, I don't think changing the other visibility modifiers should be part of this patch.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/block/src/Controller/BlockListController.php
@@ -31,4 +60,91 @@ public function listing($theme = NULL, Request $request = NULL) {
+  public function layout($theme) {

Thank you for adressing the ordering issue mentioned before!

I think the points in #115 are valid, but should not block the issue from being done.

xjm’s picture

Assigned: Unassigned » webchick

Nice to see this RTBC!

I think we will need @webchick's signoff on this one for the product implications, so assigning to her.

MattA’s picture

Assuming the testbot agrees, +1 RTBC.

googletorp’s picture

+1 on RTBC

tim.plunkett’s picture

I'd like a chance to review this as well, as the block.module maintainer.

Bojhan’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
56.23 KB

Should show the actual block type, not just "custom".

I know that we are pushing to kill the criticals off, but I'd like to leave this on needs review for a bit to make sure we are not missing any gaps.

MattA’s picture

@Bojhan The list generation is pretty much a copy/paste of the old code. Currently, core just says "Custom" too, so that should be a separate feature request.

andypost’s picture

Status: Needs review » Needs work

Also #125 shows "Block layout" twice in breadcrumbs so needs to be fixed here

dawehner’s picture

I know that we are pushing to kill the criticals off, but I'd like to leave this on needs review for a bit to make sure we are not missing any gaps.

I'm sorry but noone is stopped from looking at RTBC issues ...

MattA’s picture

@andypost So trivial... and actually from the a menu we haven't touched, but will update with fix in a few.

legolasbo’s picture

#127 fixed locally, waiting for tests to pass.

MattA’s picture

@legolasbo Oh hmm... well here's what I had. First part is the fix for #127, but I also added some more context to the page by adding the theme name to the page title since we probably shouldn't rely solely on the breadcrumb for that.

legolasbo’s picture

Status: Needs work » Needs review
FileSize
55.19 KB
10.03 KB

@MattA,

I was just about to upload my patch, but I've merged in your changes aswel. Unfortunately I don't have enough time remaining to wait for all tests to finish (the tests pass so far though).

legolasbo’s picture

Issue tags: +Needs tests

We do need tests for the Dynamic title.

xjm’s picture

Assigned: webchick » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs subsystem maintainer review, +Needs product manager review, +Needs usability review

Tagging based on @tim.plunkett's comment in #124 and my comment above. (Reference: #2457875: [policy] Evolving and documenting Drupal core's structure, responsibilities, and decision-making) Once we get these signoffs, let's list them in the summary. We can wait to assign to @webchick until it's RTBC again (after @tim.plunkett's review, fixing the bug @andypost found, etc.).

@Bojhan, did you want the opportunity to review it further as well yourself? Tagging for that too. When you think it's acceptable, please untag and mention it in the summary. :) I am sure @webchick will be glad to hold off on committing it for a few days if it's just for more general feedback.

And finally, NW for the added test coverage.

MattA’s picture

Status: Needs work » Needs review
FileSize
54.96 KB
3.96 KB

Just going to see how tests do with a clean version of the patch from #131 (also has a title test).

legolasbo’s picture

@MattA,

It seems we've taken a different approach to solving the same problem. I like your solution, but my approach matches the pattern already used by the block(_content) module. Which is why I think my pattern is a better fit. But since I don't have any time to work on this during the weekend I'll leave it up to you.

andypost’s picture

more nits

  1. +++ b/core/modules/block/block.routing.yml
    @@ -37,7 +37,16 @@ block.admin_display_theme:
    -    _title: 'Block layout'
    +    _title_callback: 'theme_handler:getName'
    

    Looks better to use controller's defined title callback to make like "Blocks for @theme"

  2. +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -143,12 +141,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +    // Override the page title of theme sub-tabs.
    +    $form['#title'] = $this->t('Block layout');
    +    ¶
         // Add a last region for disabled blocks.
    
    +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -16,6 +20,41 @@
    +  protected $themeHandler;
    +  ¶
    +  /**
    
    +++ b/core/modules/block/src/Tests/BlockUiTest.php
    @@ -132,23 +132,28 @@ function testBlockAdminUiPage() {
    +    // Also test the dynamic title.
    +    $this->assertTitle(t('Add block to layout (Classy)'));
    +    ¶
         // Trigger the custom category addition in block_test_block_alter().
    

    trailing white-space

MattA’s picture

@legolasbo Umm, might be too early for me, but I don't follow. What pattern is that?

@andypost Same with #1 here. I don't know what "controller's defined title callback" is referring to, but I think the breadcrumb title should match the tab title, so going to keep it as is for now. Fixed the whitespace though.

MattA’s picture

Status: Needs work » Needs review
legolasbo’s picture

@MattA,

In core/modules/block/block.routing.yml two routes are defined for the block layout page.

block.admin_display:
  path: '/admin/structure/block'
  ....
block.admin_display_theme:
  path: 'admin/structure/block/list/{theme}'
 ....
 

The first is used for the default theme, the second for all other themes. Your patch does not provide this 'pattern' while mine does. Besides that i think the path used by the current patch (admin/structure/block/list/{theme}/add) is not really descriptive of what should happen there. while admin/structure/block/placement(/{theme}) describes the main action at the resulting page, which is placing a block.

For the same reason I also think the path admin/structure/block/<strong>list</strong>/{theme}/add should be changed to admin/structure/block/<strong>layout</strong>/{theme}/add. But that's for another issue.

lauriii’s picture

Assigned: Unassigned » lauriii
Status: Needs review » Needs work

I'm gonna try to merge two patches we have here so that we have one patch everyone can work on! I'll come back with a patch soon.

lauriii’s picture

Assigned: lauriii » Unassigned

I won't write a patch here because of the differences were smaller than I thought. Just as an future reference it is very confusing if there is patches going in their own trees, especially if its not clearly documented what are the differences between them.

I guess what this is mostly about is

Patch #132 has path structure of:

/admin/structure/block
/admin/structure/block/list/{theme}
/admin/structure/block/placement (for the default theme)
/admin/structure/block/placement/{theme}

Patch #140 has path structure of:

/admin/structure/block
/admin/structure/block/list/{theme}
/admin/structure/block/list/{theme}/add

In #140 user is always redirected to a URL containing the theme. Also the BlockListControllers layout method has the layout as a required parameter in #140.

I personally think that the structure is better on #132, but it might be worth changing /admin/structure/block/list/{theme} into /admin/structure/block/{theme}

MattA’s picture

@legolasbo Ah I see. Well both of those paths were already there, and the new page needed a path with '{theme}' defined, so it was logical to create the new page there (not to mention the only option).

That said, we are getting into issue creep. Again. The goal here is to clean up the UI layout. We can save making route paths prettier for later.

lauriii’s picture

Status: Needs work » Needs review

I'm okay with fixing that later.

MattA’s picture

Minor note: Will need a re-roll, depending on which goes in first, due to #2514998: Reduce fragility in the monolithic BlockListBuilder.

legolasbo’s picture

@Lauriii, #132 already has MattA's page title 'feature'. All it needs is a few tests fixed because they still refer to the paths introduced by MattA. Since those tests were altered before to make the new page work, they shouldn't be hard to find.

@MattA, I disagree on improving the paths later. We've introduced this new page in this patch and should make sure we get it right the first time. It's a minor detail and we're still waiting on the UI changes to be approved anyway. So let's just fix the tests in my patch #132 and we're good to go with proper paths.

bill richardson’s picture

I find the proposed changes ( and after testing patch ) makes the block placement very much harder and less usable than before.
I can see the benefits of rearrangement of custom block button , but has anyone tested with just moving the sidebar to the left and leaving the block sidebar as is ( i personally love this feature but do agree that the + sign beside the block is confusing as it gives the impression that you can drag the block into a region ).

MattA’s picture

@bill richardson Yes. All the way back in #16. See #17 for why not.

Also, just for clarity, by "block placement" do you mean moving an existing block around (although that hasn't really changed) or adding a new block? Assuming it's the latter, we have a couple follow-up issues to help, such as #2513528: Add a link to add a block in empty regions on the Block layout page. and #2513520: Add a contextual link to add a block to a region. So once the follow-ups go in (and hopefully the intermediate pages get ajax-ified like they were in #55) the old sidebar functionality should be back.

bill richardson’s picture

If we have to proceed this way , at least implement mockup1 , where region was displayed in a column so that a block could easily be moved to another region via the dropdown .

MattA’s picture

It's still there, click 'show row weights'. Currently the sortable table is focusing on its job, which most people apparently prefer using. So if you want to use the select list (and get rid of that pesky drag icon) you'll have to click that exactly once, since your browser will remember the setting.

dawehner’s picture

@bill richardson @MattA @legolasbo
Whatever happens here keep in mind that a) we really want to fix the critical part of the issue and b) we can iterate easily and refine/improve it later

legolasbo’s picture

@dawehner,

Both patches (#132 and #140) are identical except for the fact that #140 uses sub-optimal paths and #132 stil has a few failing tests (because of the changed paths). I'm fine with #140 going in as is and fixing the paths in a follow-up issue. However if that doesn't happen before Monday morning I'd prefer to fix the tests on #132. In any case I'm not planning to do any further UI changes. I think the current patch(es) solve the issue at hand and any other UI changes should be and will be addressed in the follow-up issues which are already created.

Monday i've got all day 10:00 - 17:00 (GMT+1) to take this home. The tests (for #132) should be fixed within an hour, which should be the last bit to finalise the patch. Any new feedback from a UX review or review by subsystem maintainer or product manager can be fixed then aswel. I'll be on IRC in the mentioned timeframe if any discussion is required.

MattA’s picture

I still think it should be a separate issue, but I was also thinking, what if instead of adding more routes, we just rename the original. So instead of:

/admin/structure/block
/admin/structure/block/list/{theme}
/admin/structure/block/placement (for the default theme)
/admin/structure/block/placement/{theme}

Note: Really, route 3 shouldn't even exist either, because you should just have route 4 with {theme} as an optional parameter and dynamically change it in a RouteSubscriber.

We just have something like:

/admin/structure/block
/admin/structure/block/layout/{theme}

The path for the add action would then become: /admin/structure/block/layout/{theme}/add.

This allows us to not add more routes, not add additional code required to get the default theme in the controller and not have to subsequently create a new test. With the added benefit of the current theme tabs being under block/layout/{theme} which makes more sense than leaving block/list/{theme} in.

lauriii’s picture

Just reminding here that which paths block layout is providing shouldn't be part of a discussion in the critical issue. How does it make the UX of the block layout better? It is important to have sane path structure but it can fixed in a normal/major follow-up.

bill richardson’s picture

Status: Needs review » Needs work
FileSize
2.83 KB

The page title missing when on custom blocks tab with sub menu block selected.

MattA’s picture

Status: Needs work » Needs review

@bill richardson That's actually a problem with the Views module from what I can tell. Same thing happens with the front page view on my system. "Welcome to Drupal 8" disappears. If you disable the module you can see that it isn't a bug related to this.

MattA’s picture

Issue tags: -Needs tests

...was added/fixed way back in #140.

webchick’s picture

Wow, this issue has been busy! :)

I'm out of the loop on activity since Thursday (will try and catch up tonight), but I can only reiterate the pleas from various folks to please keep this patch the barest minimum required changes in order to fix the critical. We have the rest of the entire 8.x cycle to make additional improvements. But by all means, since you're inspecting the code here anyway, please do spin off sub-issues for any weirdness you find (such as paths or whatever).

bill richardson’s picture

MattA - yes the page title error is in beta 12 --- nothing to do with patch --- sorry for the noise.

MattA’s picture

Yeah, no changes have gone into the patch, the only thing happening has been discussion. Went ahead and created #2526766: Improve naming of block paths for @legolasbo though. Any relevant comments can go there now.

MattA’s picture

Status: Needs review » Needs work

I was going through the block module's files for a different issue and it seems like we forgot to remove the block-list.html.twig file that was used for the two-column layout (and it's hook_theme entry).

legolasbo’s picture

Assigned: Unassigned » legolasbo

@MattA,

You are right. I actually removed those in #31, but you forgot them in your fresh start. I'll remove them and will also check if we've got tests for all relevant changes.

MattA’s picture

FileSize
55.93 KB
4.44 KB

Anyways, also renamed BlockLayoutAddLocalAction to BlockLayoutLocalAction since it's technically reusable with any action on the block layout page (although we've probably learned our lesson about that...) and removed an unused trait.

MattA’s picture

Status: Needs work » Needs review
legolasbo’s picture

FileSize
55.96 KB
885 bytes

testCandidateBlockList() used to also test the block placement URL but that test was removed. Reintroduced that check.

legolasbo’s picture

FileSize
13.23 KB
19.79 KB
16.31 KB
58.21 KB
16.05 KB

While reviewing #167 to find additional things which should be tested, I encountered a discrepancy with regards to the new block placement page.

On /admin/structure/block/list/bartik/add (default theme) there is a breadcrumb trail. If i were to click the last of it's items ('bartik').
click bartik.

Expected result:
I would expect to navigate to /admin/structure/block since bartik is the default theme.
click bartik.

Actual result:
However this link leads to /admin/structure/block/list/bartik which has broken local tasks because the 'bartik' task is not selected.
click bartik.

Solution:
I solved this problem by implementing the path change I suggested in #132 which does 3 things for us.

  1. Fix the newly introduced bug described above
  2. Removes the Add block to layout (THEMENAME) title -which feels hacky to begin with - in favour of just Add block to layout.
  3. Adds local tasks to the the "Add block to layout" page which enables the user to switch themes. Just like on the Block layout page.

Besides this I've also changed any tests which were using hardcoded paths to use paths generated from the route, which should make a future change of the paths (if needed) easier to implement. To keep the scope as small as possible I've only touched things which we were already changing to begin with.

legolasbo’s picture

Status: Needs work » Needs review
FileSize
58.37 KB
448 bytes

Oops, I missed a use statement.

legolasbo’s picture

I’ve walked trough all comments since the last RTBC status in #120 to find any actionable tasks and list their status.

#125 - Bojhan - Category should show the custom block type, not just Custom. Created #2527522: Show block type in stead of "Custom" on block placement page

#127 - andypost - “Block layout” is shown twice in the breadcrumbs FIXED

#133 - legolasbo - We need tests for the dynamic title No longer relevant, dynamic title removed in latest patch.

#147 - MattA - Will need a reroll if #2514998: Reduce fragility in the monolithic BlockListBuilder lands first.

So assuming testbot agrees, I think we're there. Only needs another proper review.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Yes I agree the active link-ness is a bit sad ... but I think this does not need to block the issue at all. It is just a clear bug in our local task handling.

I gave this patch another manual try, it fixes certainly the critical issue. The code is looking fine for me as well, so I'll RTBC it, even people disagreed
with that, due to its tags.

  1. +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -50,9 +50,8 @@ protected function doViewTest() {
    -    $this->drupalGet(Url::fromRoute('block.admin_display'));
    -    $this->clickLink('<script>alert("view");</script>');
    -    $this->assertRaw('&lt;script&gt;alert(&quot;view&quot;);&lt;/script&gt;');
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    +    $this->assertRaw('alert("view");');
         $this->assertNoRaw('<script>alert("view");</script>');
    
    @@ -65,9 +64,8 @@ protected function doMenuTest() {
     
    -    $this->drupalGet(Url::fromRoute('block.admin_display'));
    -    $this->clickLink('<script>alert("menu");</script>');
    -    $this->assertRaw('&lt;script&gt;alert(&quot;menu&quot;);&lt;/script&gt;');
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    +    $this->assertRaw('alert("menu");');
         $this->assertNoRaw('<script>alert("menu");</script>');
    

    Ah we now have #markup

  2. +++ b/core/modules/menu_ui/src/Tests/MenuTest.php
    @@ -181,7 +180,7 @@ function addCustomMenuCRUD() {
    -  function addCustomMenu() {
    +  protected function addCustomMenu() {
    

    Just for the future ... try to simply avoid those changes, they add noise and make the patch a little bit harder to review.

  3. +++ b/core/modules/search/src/Tests/SearchBlockTest.php
    @@ -6,6 +6,7 @@
     
     namespace Drupal\search\Tests;
    +use Drupal\Core\Url;
    

    Nitpick: Add a new line between, can be fixed on commit.

plach’s picture

Assigned: legolasbo » webchick

Subsystem maintainers and the UX team can still mark this as needing work, if that's the case, I assume @webchick won't commit this until they are happy with it (and she is :)

webchick’s picture

Assigned: webchick » tim.plunkett

Actually, I'd love for Tim to take a look at this first. He's the Block module maintainer, and also the original coder of this UI.

But yes, would love to take a look at this before it goes in. This week isn't a travel week for me, and this is a critical issue, so I will definitely make time for it.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Status: Reviewed & tested by the community » Needs work

Leaving the "Needs subsystem maintainer review" tag on.

  1. +++ b/core/modules/block/block.module
    @@ -37,16 +37,17 @@ function block_help($route_name, RouteMatchInterface $route_match) {
    -  if ($route_name == 'block.admin_display' || $route_name == 'block.admin_display_theme') {
    -    $demo_theme = $route_match->getParameter('theme') ?: \Drupal::config('system.theme')->get('default');
    -    $themes = \Drupal::service('theme_handler')->listInfo();
    ...
    -    $output .= '<p>' . \Drupal::l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), new Url('block.admin_demo', array('theme' => $demo_theme))) . '</p>';
    -    return $output;
    ...
    +    case 'block.admin_display':
    +    case 'block.admin_display_theme':
    +      $demo_theme = $route_match->getParameter('theme') ?: \Drupal::config('system.theme')->get('default');
    +      $themes = \Drupal::service('theme_handler')->listInfo();
    ...
    +      $output .= '<p>' . \Drupal::l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), new Url('block.admin_demo', array('theme' => $demo_theme))) . '</p>';
    +      return $output;
    

    Gotta love out of scope changes! :( None of these lines needed to change at all, only the middle $output line had a change.

  2. +++ b/core/modules/block/block.routing.yml
    @@ -37,7 +37,24 @@ block.admin_display_theme:
    -    _title: 'Block layout'
    +    _title_callback: 'theme_handler:getName'
    
    +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -143,12 +141,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +    // Override the page title of theme sub-tabs.
    +    $form['#title'] = $this->t('Block layout');
    

    Not clear why we set the page title to one thing here, and then override it later. Is it just breadcrumbs? Why not fix that in a breadcrumb builder instead, at the correct level?

  3. +++ b/core/modules/block/js/block.admin.js
    @@ -19,66 +19,38 @@
    -      var $element = $($input.attr('data-element'));
    ...
    +      var $table = $($input.attr('data-element'));
    ...
    -        function showBlockEntry(index, block) {
    -          var $block = $(block);
    ...
    -          var textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
    -          $block.toggle(textMatch);
    +        function toggleBlockEntry(index, label) {
    +          var $label = $(label);
    ...
    +          var textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
    +          $row.toggle(textMatch);
    ...
    -        // Filter if the length of the query is at least 2 characters.
    +        // Filter if the query is at least 2 characters.
    ...
    -          $blocks.each(showBlockEntry);
    ...
    +          $filter_rows.each(toggleBlockEntry);
    

    More completely unnecessary changes

  4. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +60,93 @@ public function listing($theme = NULL, Request $request = NULL) {
    +    // Do not display the 'broken' plugin in the UI.
    +    unset($definitions['broken']);
    ...
    +        return strnatcasecmp($a['admin_label'], $b['admin_label']) * ($sort == 'asc' ? 1 : -1);
    

    This is supposed to be handled by the block manager, it should not be done here.

  5. +++ b/core/modules/block/src/Controller/BlockListController.php
    @@ -31,4 +60,93 @@ public function listing($theme = NULL, Request $request = NULL) {
    +    $rows = [];
    

    When moving this out of BlockListBuilder, switching the array syntax really didn't help keep it as reviewable :(

  6. +++ b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
    @@ -61,18 +61,18 @@ public function testBlockLinks() {
    -      $this->drupalGet('admin/structure/block', array('language' => $langcode));
    +      $this->drupalGet('admin/structure/block/layout/classy', ['language' => $langcode]);
    

    Shouldn't this new route (and all the rest) omit /classy from the route, just like the previous path did?

  7. +++ b/core/modules/block/src/Tests/BlockLanguageCacheTest.php
    @@ -61,18 +61,18 @@ public function testBlockLinks() {
    -    $this->assertText(t('Menu @label has been added.', array('@label' => $edit['label'])));
    +    $this->assertText(t('Menu @label has been added.', ['@label' => $edit['label']]));
    
    +++ b/core/modules/block/src/Tests/BlockUiTest.php
    @@ -91,7 +92,7 @@ public function testBlockDemoUiPage() {
    -  function testBlockAdminUiPage() {
    +  public function testBlockAdminUiPage() {
    
    @@ -138,23 +139,26 @@ function testBlockAdminUiPage() {
    -    $arguments = array(
    ...
    +    $arguments = [
    ...
    -    );
    +    ];
    

    More unnecessary patch bloat.

  8. +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -50,9 +50,8 @@ protected function doViewTest() {
    -    $this->assertRaw('&lt;script&gt;alert(&quot;view&quot;);&lt;/script&gt;');
    ...
    +    $this->assertRaw('alert("view");');
    
    @@ -65,9 +64,8 @@ protected function doMenuTest() {
    +    $this->assertRaw('alert("menu");');
    
    @@ -85,9 +83,8 @@ protected function doBlockContentTest() {
    -    $this->assertRaw('&lt;script&gt;alert(&quot;block_content&quot;);&lt;/script&gt;');
    ...
    +    $this->assertRaw('alert("block_content");');
    

    This change makes me VERY nervous. This is a security test, why is it being changed?!

  9. +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
    @@ -48,10 +47,10 @@ protected function setUp() {
    -    $this->drupalLogin($this->drupalCreateUser(array('administer views', 'administer blocks')));
    +    $this->drupalLogin($this->drupalCreateUser(['administer views', 'administer blocks']));
    ...
    -    $edit = array();
    +    $edit = [];
    

    ...

  10. +++ b/core/modules/search/src/Tests/SearchBlockTest.php
    @@ -35,7 +36,7 @@ protected function setUp() {
    -    $this->drupalGet('admin/structure/block');
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    
    +++ b/core/modules/views/src/Tests/Wizard/BasicTest.php
    @@ -132,7 +132,7 @@ function testViewsWizardAndListing() {
    -    $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => $this->config('system.theme')->get('default')]));
    

    As before: Compare these two changes. The second still passes the theme, the first adds in 'classy' for no apparent reason. Use the other theme-less route or we'll lose test coverage.

tim.plunkett’s picture

Also, why is the modal removed from "Add block"?

dawehner’s picture

@tim
I hope you don't try to be defensive on this issue.

This change makes me VERY nervous. This is a security test, why is it being changed?!

Well, because its now rendered differently, just try it out.

Also, why is the modal removed from "Add block"?

Bojhan’s picture

@tim.plunkett For this see #101. It basically comes down to the following. The way we use modals in Drupal (and should) is to show a modal dialog when you want to make a "quick action" and then return to the listing.

Currently we only apply this pattern in Views and the blocks UI. Now that we are moving it to a separate page, having a modal on the listing you don't return to is non-sensical. It provides no valuable context or point you typically return back to. As when clicking save you do not return to the "add block" listing -> instead you go to the blocks layout page (which in this usecase is the preferred flow).

I'd also like to add that for consistency with core UI patterns, it makes sense to remove the modal from this place. Sadly its very poorly implemented as a standard interaction across core. You currently only encounter it in the views UI and CKeditor to some extent. The blocks UI implementation is kind of a one-off, since we don't provide this pattern on any other listing.

tim.plunkett’s picture

Thanks @Bojhan and @dawehner, makes sense.

#175 parts 1-7, 9-10 still remain.

dawehner’s picture

Assigned: Unassigned » dawehner

Quickly addressing this together with some small other stuff.

Thank you tim!

dawehner’s picture

Assigned: dawehner » tim.plunkett
Status: Needs work » Needs review
FileSize
53.99 KB
27.87 KB

I hope I managed to address all the points from tim.

googletorp’s picture

Adding missing documentation to toggleBlockEntry in block.admin.js to make it pass ESLint. Since we made changes in the function that would require the docs to be updated anyways (change name of variable) this should be part of the patch. Not sure why it got removed, since it was added earlier.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs tests

The JS changes weren't reverted at all, but oh well.

  1. +++ b/core/modules/block/block.module
    @@ -20,14 +20,15 @@
    -      $block_content = \Drupal::moduleHandler()->moduleExists('block_content') ? \Drupal::url('help.page', array('name' => 'block_content')) : '#';
    +      $block_content = \Drupal::moduleHandler()
    +        ->moduleExists('block_content') ? \Drupal::url('help.page', array('name' => 'block_content')) : '#';
    

    Revert please

  2. +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -306,69 +303,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    -      $category = SafeMarkup::checkPlain($plugin_definition['category']);
    
    +++ b/core/modules/block/src/Controller/BlockLayoutListController.php
    @@ -0,0 +1,116 @@
    +      $row['category']['data'] = $plugin_definition['category'];
    

    Tested this like this:

    diff --git a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
    index c768e21..a8208dd 100644
    --- a/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
    +++ b/core/modules/system/src/Plugin/Block/SystemPoweredByBlock.php
    @@ -16,6 +16,7 @@
      *
      * @Block(
      *   id = "system_powered_by_block",
    + *   category = @Translation("<script>alert('asdf');</script>"),
      *   admin_label = @Translation("Powered by Drupal")
      * )
      */
    
    

    and it is broken. Needs tests! :(

  3. +++ b/core/modules/block/src/Tests/BlockUiTest.php
    @@ -139,22 +140,25 @@ function testBlockAdminUiPage() {
    -    $this->drupalGet('admin/structure/block');
    ...
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    ...
    -    $this->drupalGet('admin/structure/block');
    ...
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    
    +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -50,9 +50,9 @@ protected function doViewTest() {
    -    $this->drupalGet(Url::fromRoute('block.admin_display'));
    ...
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    
    @@ -65,9 +65,9 @@ protected function doMenuTest() {
    -    $this->drupalGet(Url::fromRoute('block.admin_display'));
    ...
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    
    @@ -85,9 +85,9 @@ protected function doBlockContentTest() {
    -    $this->drupalGet(Url::fromRoute('block.admin_display'));
    ...
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    
    +++ b/core/modules/search/src/Tests/SearchBlockTest.php
    @@ -35,7 +36,7 @@ protected function setUp() {
    -    $this->drupalGet('admin/structure/block');
    +    $this->drupalGet(Url::fromRoute('block.admin_layout_theme', ['theme' => 'classy']));
    

    These are still the wrong routes (should not hardcode classy)

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
8.76 KB
52.75 KB

Removing BlockLayoutLocalAction, we don't need it.

Fixing #183.1 and #183.3, point 2 still needs work.

tim.plunkett’s picture

+++ b/core/modules/block/src/Controller/BlockLayoutListController.php
--- a/core/modules/block/src/Controller/BlockListController.php
+++ b/core/modules/block/src/Controller/BlockListController.php

+++ b/core/modules/block/src/Controller/BlockListController.php
+++ b/core/modules/block/src/Controller/BlockListController.php
@@ -7,7 +7,10 @@

@@ -7,7 +7,10 @@
 
 namespace Drupal\block\Controller;
 
+use Drupal\Core\Block\BlockManagerInterface;
 use Drupal\Core\Entity\Controller\EntityListController;
+use Drupal\Core\Url;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Request;

Whoever rerolls next, please remove these :)

tim.plunkett’s picture

I'd like to put in my 2 cents:

I do not agree with this approach, I think it is heavy-handed and brings us further away from an ideal UI.
Moving it to the left and tweaking some wording would be enough to make it no longer critical, and allow us to work on a better interaction pattern.

That said, I won't hold this up, and barring any drastic changes other than adding test coverage and fixing the XSS, I think this is implemented correctly.

jibran’s picture

+1 to the current direction. IS needs an update of screenshots.

MattA’s picture

1. admin/structure/block/layout should be admin/structure/block/add
It was admin/structure/block/list that should have been layout, but yea, patch minimalism and everything.
2.
Odd breadcrumb list.
Seems... less than ideal.
3. Regarding the JS, while it may look similar, it was actually rebuilt from scratch. Quite frankly I think 5 seconds of extra review time is worth the better variable and function names there too. :P

webchick’s picture

Well spotted, but note that smaller issues like that can easily be follow-ups once the critical problem is fixed.

dawehner’s picture

I think the product manager should make a deal with the subsystem maintainer to ensure that we don't block each other.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

1) Those paths are pretty wack, now that I look at them again. Going to see what I can do about that.
2) Just to be clear, it looked like that before my changes... Might be follow-up worthy.
3) Fair enough

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Issue tags: -Needs tests
FileSize
56.04 KB
56.11 KB
1004 bytes
20.19 KB

Changed /admin/structure/block/layout to /admin/structure/block/library. It's not the layout, /admin/structure/block is. Renamed BlockLayoutListController::layout() to BlockLibraryController::listBlocks() accordingly.

Also added the tests and fix for the XSS issue.

dawehner’s picture

  1. +++ b/core/modules/block/block.links.action.yml
    @@ -1,10 +1,10 @@
    -  route_name: block.admin_layout
    +  route_name: block.admin_library
    

    +1 to make sense!!! Maybe the route names could go with plugin_library, to distinct maybe from the custom block one?

  2. +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -26,7 +26,33 @@ class BlockXssTest extends WebTestBase {
    +  public function _testXSSInTitle() {
    

    No, yes?

  3. +++ b/core/modules/views_ui/src/Tests/OverrideDisplaysTest.php
    @@ -110,7 +110,7 @@ function testWizardMixedDefaultOverriddenDisplays() {
    diff --git a/interdiff-test-fix.txt b/interdiff-test-fix.txt
    
    diff --git a/interdiff-test-fix.txt b/interdiff-test-fix.txt
    new file mode 100644
    
    new file mode 100644
    index 0000000..2c874ee
    
    index 0000000..2c874ee
    --- /dev/null
    
    --- /dev/null
    +++ b/interdiff-test-fix.txt
    
    +++ b/interdiff-test-fix.txt
    +++ b/interdiff-test-fix.txt
    @@ -0,0 +1,21 @@
    
    @@ -0,0 +1,21 @@
    +diff --git a/core/modules/block/src/Controller/BlockLibraryController.php b/core/modules/block/src/Controller/BlockLibraryController.php
    +index 187fe7b..703089c 100644
    +--- a/core/modules/block/src/Controller/BlockLibraryController.php
    ++++ b/core/modules/block/src/Controller/BlockLibraryController.php
    +@@ -7,6 +7,7 @@
    + ¶
    + namespace Drupal\block\Controller;
    + ¶
    ++use Drupal\Component\Utility\SafeMarkup;
    + use Drupal\Core\Block\BlockManagerInterface;
    + use Drupal\Core\Controller\ControllerBase;
    + use Drupal\Core\Url;
    +@@ -74,7 +75,7 @@ public function listBlocks($theme = NULL) {
    +         '#prefix' => '<div class="block-filter-text-source">',
    +         '#suffix' => '</div>',
    +       ];
    +-      $row['category']['data'] = $plugin_definition['category'];
    ++      $row['category']['data'] = SafeMarkup::checkPlain($plugin_definition['category']);
    +       $links['add'] = [
    +         'title' => $this->t('Add block'),
    +         'url' => Url::fromRoute('block.admin_add', ['plugin_id' => $plugin_id, 'theme' => $theme]),
    

    We need to go deeper!

tim.plunkett’s picture

Issue summary: View changes
FileSize
1.75 KB
56.11 KB

1) Custom Block doesn't use the word library any more as of this patch
2) Whoops!
3) Heh.

Can someone update the screenshots in the IS to match reality?

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs screenshots

1) Custom Block doesn't use the word library any more as of this patch

Ah, good point.

+1 for RTBC-ness of that issue, but I have been too positive in the past here.

jibran’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

It needs a change notice as well. NW for every need tag.

larowlan’s picture

Few observations, mostly nits but one where I think we're losing some coverage

  1. +++ b/core/modules/block/block.module
    @@ -37,14 +37,14 @@ function block_help($route_name, RouteMatchInterface $route_match) {
    +    $output = '<p>' . t('This page provides a drag-and-drop interface for adding a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. To add a block to this theme\'s layout, click the <em>Add block to layout</em> button. After moving blocks, remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
    

    nit: can we use " here instead of ' and \'. I recall using \' as bad form for translators

  2. +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -26,7 +26,33 @@ class BlockXssTest extends WebTestBase {
    +   * Test XSS in title.
    

    should this be Test XSS in category given the method name?

  3. +++ b/core/modules/block/src/Tests/BlockXssTest.php
    @@ -50,9 +76,9 @@ protected function doViewTest() {
    -    $this->assertRaw('&lt;script&gt;alert(&quot;view&quot;);&lt;/script&gt;');
    ...
    +    $this->assertRaw('alert("view");');
    
    @@ -65,9 +91,9 @@ protected function doMenuTest() {
    -    $this->assertRaw('&lt;script&gt;alert(&quot;menu&quot;);&lt;/script&gt;');
    ...
    +    $this->assertRaw('alert("menu");');
    
    @@ -85,9 +111,9 @@ protected function doBlockContentTest() {
    -    $this->assertRaw('&lt;script&gt;alert(&quot;block_content&quot;);&lt;/script&gt;');
    ...
    +    $this->assertRaw('alert("block_content");');
    

    Shouldn't we also be asserting that <script> doesn't exist?

larowlan’s picture

Just did some manual testing.
As maintainer of block content module, I think this issue is a step backwards.
Drupal 8 comes with a killer new feature - fieldable blocks and block types.
But you'd struggle to find it.

How do you add a new custom block now?
Not here (and note no help text pointing me to the tab):

or here (again no help text):

I think we're burying a killer feature.
Sorry to be negative, but kind of makes me a sad panda to see stuff you worked hard on buried away.

So I think we're missing two major things here:

a) Help text on the block layout page indicating how to add a custom block
b) Help text on the 'add block to layout' page.

Fabianx’s picture

I share #201.3: This needs a comment.

Just saying it changed, is not enough. As this stands now, from the outside it seems like a security regression.

xjm’s picture

Also needs a reroll following #2514998: Reduce fragility in the monolithic BlockListBuilder -- if the reroll turns out to be onerous we can revert the other issue. I pinged @tim.plunkett to have a look.

MattA’s picture

@larowlan We were well aware of how custom blocks would be nearly impossible to find when we removed the action link, which is why we created #2523154: Improve workflow for creating custom blocks a while back. So far, we're thinking about adding it to the 'admin/content' path, which would be a major step up from where it was, especially since pretty much every normal person defines blocks as content anyways! :)

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett

I'll handle the reroll. I'll be discussing this issue with Bojhan today, I'll include talking about custom blocks.

tim.plunkett’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record
FileSize
58.19 KB

This in no way needs a CR.

Straight reroll, no changes.

The other issue really isolated the changes this has to make in BlockListBuilder, yay.

googletorp’s picture

Status: Needs review » Needs work
+++ b/core/modules/block/js/block.admin.js
@@ -48,37 +31,26 @@ function filterBlockList(e) {
          * @param {number} index
          * @param {HTMLElement} block
          */
-        function showBlockEntry(index, block) {
-          var $block = $(block);
-          var $sources = $block.find('.block-filter-text-source');
-          var textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
-          $block.toggle(textMatch);
+        function toggleBlockEntry(index, label) {
+          var $label = $(label);
+          var $row = $label.parent().parent();
+          var textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
+          $row.toggle(textMatch);

This JavaScript doc block needs to be updated, as the variable name changed. Might as well add the missing documentation since we are touching this.

I've added this myself a few times, not sure who keeps removing it, but the docs does need to update. #182 has interdiff with the missing stuff.

jibran’s picture

Bojhan’s picture

Following tim.plunkett and larowlan their concerns we decided to have a call. Webchick, tim.plunkett and Bojhan have spent an hour going over the various concerns and thinking of solutions. This is a write up of that call collaboratively written.

Previous testing
In the testing we did (to add some clarification we saw that users):

We asked people to place a list of recent registered event attendees in the sidebar. (going for "Who's new" block)

  1. Generally, people first tried to add the block from the front-end via contextual links, which is not possible. From their point of view, adding it contextually is what they are looking for. (We can/should add an option here (in a separate issue), but it would only work for exposed regions.)
  2. Then they often went to Appearance. This is perfectly logical; you're controlling how your site looks by determining which blocks show up where/when. (We can/should discuss moving the block placement page to Appearance in another issue.)
  3. No one saw the right sidebar. That is the critical issue we need to solve here.
  4. Thus, they followed the "Add custom block" action, which did not make them create the right block and they missed the concept of existing blocks completely.

Current solution and its challenges
The solution that we arrived at in #17 was to remove the major confusion of add custom blocks being the primary action and replacing it with a block placement as the primary action. With that, aligning it better with core design patterns.

However, in the feedback we identified the following three issues with this approach:

  • It moves the block “placement” further away from the blocks layout page, which was an important goal and achievement of the current design.
  • It still leaves people looking at the region and then going back to “add action” to place it, versus putting the "add action" where it's more contextually relevant (on the region itself).
  • The custom blocks add interaction is much more buried in the current patch, making it harder to discover.

Solution
We need to shift our approach a little bit to come closer to the core of this problem. The current patch does not solve the issue of people gravitating towards the regions themselves. Whatever sidebar position, or add button we place - people will continue to gravitate towards the idea that regions are the primary thing being shown on the block placement page.

With that in mind, we feel a better solution would be to bring block placement action more in context of the regions on the page.

We propose to do the following:

  1. Keep most of the patch in place (e.g. removing sidebar, removing add custom block from the top of admin/structure/blocks)
  2. Remove the "Add block to layout" button from the top of admin/structure/block, to bring it more inline with existing pattern of "listing page, add a thing to this listing page." (Then in #2513580: [Regression] Demonstrate block regions link in Block layout should be visible even if help module is not enabled will can make "Demonstrate block regions" the primary action on this page so it is more visible!)
  3. Instead, add a “Place block” button next to the label of each region, styled after the "Add" buttons in Views UI (the buttons everywhere effect, could be less with proper spacing):
    Add 'place block' buttons to each region header
  4. Clicking these buttons opens a modal where you get the list of blocks to place. (Essentially the existing page in the patch, but in a modal)
  5. Add the “add custom block” action button on this listing instead. (Pretend this page is in a modal and the two primary tabs are not present.)
    Add custom block goes on top of the list of existing blocks
  6. After choosing a block, you get the next modal with block configuration.

This solution should handle all the concerns we identified, while keeping a sane approach to getting this issue fixed.

Updating the issue summary with this new proposed resolution.

tim.plunkett’s picture

Leaving this assigned to myself, will work on a first patch maybe tonight, or definitely first thing tomorrow.

larowlan’s picture

Thanks @Bojhan
a) this looks great
b) it will provide a nice sample-case of multistep modals in core.

webchick’s picture

Updating the issue summary's proposed resolution based on the new proposal.

Also noting that we're now officially rolling in #2513528: Add a link to add a block in empty regions on the Block layout page. as part of this solution now, to remind myself to credit those folks on commit as well.

webchick’s picture

Issue summary: View changes

Adding a note that we should not call the buttons next to all the blocks in the library "Add block" but "Place block," so they don't get confused with the "Add custom block" button above.

Wim Leers’s picture

#210 sounds great.

@Bojhan++
@tim.plunkett++
@webchick++

davidhernandez’s picture

Question - with this solution, how will one create a custom block without adding it to a region? Also, will the disabled blocks still be available down below on the main page?

MattA’s picture

@Bojhan Thanks for the roll-up. So if I understand it correctly, we're basically sticking with the plan we had to begin with? Notwithstanding the slight modification for the action button which could have been part of #2513580. Also, to be clear, is part 5 still a separate issue? Seems like some of the stuff brought up in #2523154: Improve workflow for creating custom blocks would be out-of-scope if not.

@davidhernandez From what I can gather, the custom block tab should still be there in the main page and disabled blocks have their own issue.

tim.plunkett’s picture

#216, the same way you do now, via the local task on admin/structure/blocks (the local action in HEAD will take you into the place block workflow)

Disabled region is being removed in #2513534: Remove the 'disabled' region from Block UI

#217, not sure what the original plan was, but it's probably close.
We're just moving the custom-block-into-place-block-workflow button from admin/structure/block into the modal, it doesn't step on the other issue that much.

Gábor Hojtsy’s picture

#210 makes a ton of sense to me too. I went to try the latest patch and it was indeed far from as intuitive as the plan in #210 sounds like.

davidhernandez’s picture

Just to be clear, I'm specifically talking about creating a custom block without placing it in a specific region. Starting disabled. Right now, the "Add custom block" button on admin/structure/block and admin/structure/block/block-content ("Custom block library") both use the same form, block/add. It reads like that action would become the modal talked about in #210? Just making sure we aren't losing the generic functionality. Wanting to add a custom block without choosing a region is not an uncommon use.

tim.plunkett’s picture

When going via /admin/structure/block/block-content, the path for adding the block becomes /block/add?destination=/admin/structure/block/block-content, which prevents it from going into the "Place block" flow. That will not change.

tkoleary’s picture

@bojhan

re:

Generally, people first tried to add the block from the front-end via contextual links, which is not possible. From their point of view, adding it contextually is what they are looking for. (We can/should add an option here (in a separate issue), but it would only work for exposed regions.)

I think something like this will likely be the common use in D8 with several competing contrib solutions arising. Here is one already that's interesting (despite the poorly named project) https://www.drupal.org/project/edit_ui

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
42.09 KB
35.21 KB

Here's a first pass.
The only visual problem I know for sure, is that modals don't include other regions, so the local action (Add custom block) is not included :(

dawehner’s picture

It is great that we have now more consensus.

tim.plunkett’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
35.96 KB
763 bytes
90.82 KB
103.32 KB

Missed a spot in the tests.


dawehner’s picture

It looks like views, so it can't be bad ;)

googletorp’s picture

Issue tags: -Needs screenshots

I've looked at the code, and all look good to me.

I've also done some manuel testing and all seems to work very nice.

All in all I think this is good.

One thing I noted, is that there is a lot of place block buttons, which can me it hard to figure out which one to click at glance, when there aren't so many blocks in the region. I'm not sure if this is an issue or not, I'll leave this up to the usability review.

Does the issue still need summary update?

tim.plunkett’s picture

Okay, adding a workaround for that.

Nope, no more IS update needed.

Yes, I agree it looks crowded when there aren't many blocks, but I don't know what to do about that.

dawehner’s picture

+++ b/core/modules/block/src/Controller/BlockLibraryController.php
@@ -0,0 +1,179 @@
+    $build = $this->localActionManager->getActionsForRoute($this->routeMatch->getRouteName());
+    // Without this workaround, the action links will be rendered as <li> with
+    // no wrapping <ul> element.
+    if (!empty($build)) {
+      $build['#prefix'] = '<ul class="action-links">';
+      $build['#suffix'] = '</ul>';
+    }
+    return $build;

Can't we just call out to the block plugin directly? Curious whether this would be a good idea

tim.plunkett’s picture

It doesn't even belong to this module, it's from block_content, so I don't think we should hardcode it.

larowlan’s picture

This looks great - only thing issue I can see is this:

+++ b/core/modules/block/src/BlockListBuilder.php
@@ -229,10 +215,20 @@ protected function buildBlocksForm() {
+        '#title' => $this->t('Place block'),

We'll need more context here for non-sighted users - suggest Place block <span class=visually-hidden>in the %region region</span>

pity the action links ul is part of page.html.twig instead of a theme wrapper.

Manual review next

larowlan’s picture

So the workflow for adding a custom block is now:

  • Visit block layout
  • Click place block next to a region (modal)
  • Click add custom block action link (modal)
  • Redirect to block/add (non modal)
  • Add custom block content entity (non modal)
  • Redirect to place block form (non modal)
  • Save block placement
  • Redirect to block layout, new block highlighted

It feels a bit clunky, but is not really any different to what we have in HEAD so I think exploring remaining in the modal is OK to make a follow-up.

tim.plunkett’s picture

Good call on #232. The code change is a little ugly, but only until #2513534: Remove the 'disabled' region from Block UI goes in.

#233 isn't a show-stopper to me, we already have #2523154: Improve workflow for creating custom blocks to handle that.

andypost’s picture

Test patch:
1) Modal should not have operations - they are links to next page to configure block.
2) Place block is a second line under region title
3) revert #234 to add title hint

  1. +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -229,10 +215,20 @@ protected function buildBlocksForm() {
    +        '#title' => $this->t('Place block <span class="visually-hidden">in the %region region</span>', ['%region' => $block_regions_with_disabled[$region]]),
    

    Suppose title should be enough for
    accessibility

  2. +++ b/core/modules/block/src/BlockListBuilder.php
    @@ -229,10 +215,20 @@ protected function buildBlocksForm() {
    +          'class' => ['use-ajax', 'button', 'button--small'],
    

    button-small class is not used and defined

tim.plunkett’s picture

doesnt follow the mock, will revert tomorrow.
If someone wants to fix the failures in #234, feel free

webchick’s picture

Yeah, links IMO don't work here. Links indicate to users that you're navigating off somewhere else (and in many places this causes you to lose your work, and thus can make them somewhat scary to use). Operation buttons OTOH make it clear that this is an action being taken. We could explore ways to make the page less visually overwhelming (e.g. change the button label to just "Place"), but let's do that in a non-critical follow-up.

dawehner’s picture

Looking at the test failures.

tim.plunkett’s picture

#236.2, button--small is defined in core/themes/seven/css/components/buttons.css line 130, and is used by seven_preprocess_menu_local_action() which we're mimicking here.

Thanks @dawehner, I can't deal with xpath tonight...

dawehner’s picture

Status: Needs work » Needs review
FileSize
39.33 KB
906 bytes

Xpath can't deal with me neither, take that!

dawehner queued 242: 2512456-242.patch for re-testing.

Manjit.Singh queued 242: 2512456-242.patch for re-testing.

andypost’s picture

@webchick so what about to use links in dialog? this is exactly navigation purpose (navigate to block settings form) .. for me the same applies to "Place block" link in list - navigate to list of available blocks.

No data is could be lost because it's navigation

Actually I was trying to use contextual module links when hovering over region name but it looks that "shortcut module link style" (start near page title) looks better and more self-descriptive

+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -2342,7 +2342,7 @@ protected function handleForm(&$post, &$edit, &$upload, $submit, $form) {
-    $urls = $this->xpath('//a[normalize-space()=:label]', array(':label' => $label));
+    $urls = $this->xpath('//a[starts-with(normalize-space(), :label)]', array(':label' => $label));

does not make sense... we need to check link as a whole

+++ b/core/modules/block/src/BlockListBuilder.php
@@ -229,10 +215,20 @@ protected function buildBlocksForm() {
+        '#type' => 'link',
+        '#title' => $this->t('Place block <span class="visually-hidden">in the %region region</span>', ['%region' => $block_regions_with_disabled[$region]]),

An the link name now incredible long

Manjit.Singh’s picture

FileSize
152.86 KB
1.38 MB

@tim.plunkett @andypost when i am placing blocks to another region then it seems like it's background color is same as error. Please check screenshot and screencast i have attached.

alt

tim.plunkett’s picture

#248 I'm going to stick with the usability expert. If you want it changed from a button to a link, please open a normal follow-up.

"An the link name now incredible long"
That's what .visually-hidden is for, you'll only see "Place block", the rest is for screen readers.

#249, that's an existing condition, please open another issue.

I think I have a reasonable compromise fix, coming shortly.

tkoleary’s picture

@tim.plunkett, @webchick

I think that since this issue arose out of the Minnesota usability test, in order to mark it RTBC the patch must pass follow-up usability testing.

Thoughts?

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
41.3 KB
12.68 KB

Interdiff is from #234

This just adds a clickLinkPartialName() method

dawehner’s picture

+1 for a dedicated method!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I think that since this issue arose out of the Minnesota usability test, in order to mark it RTBC the patch must pass follow-up usability testing.

Well, I think given that we have a similar pattern in views, users can use it already. People never had hard problems with it.
On top of that, we want to iterate for the future, so halting back now, is just a wrong thing to do.

tim.plunkett’s picture

If we have @Bojhan sign off on this, I think that's enough. +1 for RTBC.

tim.plunkett’s picture

@Manjit.Singh #2396937: "Last placed block" color confusing in Block layout page is slated to address the confusing color

Bojhan’s picture

Status: Reviewed & tested by the community » Needs work

A small issue, the "search box" on the blocks listing should be moved to the right (where we normally have the show weights link) to avoid any confusion about that two. We learned from testing that closing these elements close to each other, might have people perceive they need to enter something in it and then click "add".

The rest looks fine.

Do we have all the appropriate followups in place?

webchick’s picture

@tkoleary This is a critical, and putting usability testing together is not easy, so I would -1 requiring it prior to commit. It's also much easier to usability test if the instructions are "download the latest Drupal 8 beta" and not "Clone Drupal 8 from Git, apply this patch..."

However, if someone would like to usability test it after commit, that would be very welcome. I'm pretty confident we will not hit another critical usability regression with this approach, but we could definitely find things that could be further cleaned up.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
FileSize
41.41 KB
421 bytes
83.53 KB

@Bojhan @LewisNyman This "works", not sure what more you'd want. I know we shouldn't use IDs, but we need to be careful to only target the part within the modal.

Bojhan’s picture

Issue tags: -Needs usability review

This looks good to me :)

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I think #drupal-modal is fine, given that there will be just one modal on the page.

tim.plunkett’s picture

Assigned: Unassigned » LewisNyman
Status: Reviewed & tested by the community » Needs work

This CSS doesn't work in FF, clear:left on the table works, but I'm just going to leave this for lewis.
Sorry @dawehner

webchick’s picture

Functionality review from a "product manager" POV:

Everything works as expected. I can click the "Place block" button next to any region and its region selector gets pre-populated correctly. The filter in the block listing is working great. If you want to add a custom block without putting it in a region, you can do that from the "Custom block library" tab. I tried various ways to break it and could not. AWESOME work!

Here's my list of specific commit-blockers/follow-ups:

  1. (commit-blocker) The display of the modal is jacked up in Firefox:
    Add custom block button on left, smooshing everything else over.
  2. (follow-up #1a (major): "Improve block search") I don't understand at all why we moved the search bar to the right. a) We already know over and over and over again that people *do not* see stuff on the right (that's what caused this issue to begin with!) b) We don't do that on the modules page, nor on the views listing (which also has an action button btw, at least for now), so this introduces inconsistency. However, I definitely don't want to block commit of a critical on such an aesthetic issue.
  3. (follow-up #1b (major): "Improve block search") This was a "pre-existing condition" so we shouldn't block commit on this either, but the search box here (unlike the one on the modules page) is lacking a label, which AFAIK is required for accessibility.
  4. (follow-up #2 (normal): "Revisit labeling in blocks UI") We might want to tweak some of the labels, for example move from "Place block" to "Place" on the library listing page to make it less overwhelming, and change the action button on the subsequent config form (in the modal) from "Save block" to "Place block."
tim.plunkett’s picture

#263

2) If we don't want block search on the right, then #252 could be committed... #257 had the reasoning
3) It has a label but it is visually-hidden, so that's not a bug
4) Follow-up needed

webchick’s picture

Or, in lieu of follow-up 1a, I would rather we go back to the patch in #252 which had the search/add buttons together, and open a follow-up (one probably already exists?) about the valid issues that #257 is pointing out came through in testing. We do need indeed to look at that, but IMO we need to do so systematically, not one-off on this page.

webchick’s picture

Assigned: LewisNyman » tim.plunkett
Status: Needs work » Reviewed & tested by the community

Ok, it looks like attempting to move the search bar to the right is what caused the Firefox issue to begin with.

Therefore, I'm going to RTBC #252, and aim to commit this this evening in order to allow Bojhan a few hours to respond.

webchick’s picture

Saving credit.

Bojhan’s picture

Alright, lets move this in. Webchick informed that this was a pre-existing condition (found on modules page for example). Sadly we are exposing that problem here again, while its annoying - we should not hold up commit on a relatively small issue that can be solved in followup.

Can we please make sure we assign appropriate priority to these small but still usability problem inducing issues?

  • webchick committed 6b95f9a on 8.0.x
    Issue #2512456 by tim.plunkett, legolasbo, MattA, dawehner, googletorp,...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, then... we are a-go!! :D

Committed and pushed to 8.0.x. YEAH!! Was so great to see this come together so quickly! Thanks to everyone for their help!!

webchick’s picture

Issue tags: +Needs followup

Also tagging for follow-ups. I think we need at least two: one about the search problems mentioned in #257 (may already exist and be tagged "UMN 2015") and one for some minor cosmetic changes we might want to make for button labeling, etc.

almaudoh’s picture

+1000. A lot has gone on in this issue since I last looked. Great job folks!!

For me, the most important thing is like @larowlan said in #212:

b) it will provide a nice sample-case of multistep modals in core.

I'm going to be one of the first beneficiaries of multistep modals' sample in core.

MattA’s picture

Seems we lost all the help text updates too, "click the block title under Place blocks" references the old sidebar (although oddly enough it would've made sense with the UI in #236).

nod_’s picture

Issue tags: +JavaScript
legolasbo’s picture

tkoleary’s picture

@webchick

However, if someone would like to usability test it after commit, that would be very welcome. I'm pretty confident we will not hit another critical usability regression with this approach, but we could definitely find things that could be further cleaned up.

Sure, that makes sense. Melissa Leach and Julie Fischer here in Boston have said they'd be willing to test it.

Status: Fixed » Closed (fixed)

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