Description to reproduce the issue as follows:

Going to Custom Block Library -> Block types (admin/structure/block/block-content/types)
Step 1

Now selecting “Manage Fields”
Step 2

You are getting here
Step 3

Now if you click “Custom Block library” in the Breadcrumbs section you get taken to here (the blocks section of the Custom block library)
Step 4

While one would expect to be taken to the “Block types” section of the Custom block library (see first image) where you were coming from.

I am considering this as to be an inconsistent workflow. This in not only applying to “Manage fields” operation but to all operations.
Changing the routing paths can make this work in a more consistent way.

Will provide a patch for this.

CommentFileSizeAuthor
#54 Screenshot 2023-01-14 201130.jpg21.17 KBaaronmchale
#47 interdiff_45-47.txt757 bytesranjith_kumar_k_u
#47 2937066-47.patch4.04 KBranjith_kumar_k_u
#45 interdiff_44-45.txt1.58 KBranjith_kumar_k_u
#45 2937066-45.patch3.97 KBranjith_kumar_k_u
#44 core-inconsistent_breadcrumbs-2937066-044.patch3.96 KBstefan.korn
#38 interdiff_37-38.txt1.81 KBraman.b
#38 2937066-38.patch4.06 KBraman.b
#37 2937066-37.patch3.95 KBabhijith s
#36 2937066-36.patch1.59 KBabhijith s
#28 interdiff-2937066-019-022.txt2.33 KBstefan.korn
#28 interdiff-2937066-015-022.txt3.28 KBstefan.korn
#23 manage_fields.png52.68 KBstefan.korn
#23 edit block type.png53.51 KBstefan.korn
#23 delete block type.png57.4 KBstefan.korn
#23 add basic block.png50.7 KBstefan.korn
#23 add block.png45.69 KBstefan.korn
#22 core-inconsistent_breadcrumbs-2937066-022.patch3.92 KBstefan.korn
#19 core-inconsistent_breadcrumbs-2937066-019.patch3.73 KBstefan.korn
#18 interdiff-2937066-15-18.txt2.43 KBharsha012
#18 2937066-18.patch3.65 KBharsha012
#15 core-inconsistent_breadcrumbs-2937066-015.patch3.56 KBstefan.korn
#12 core-inconsistent_breadcrumbs-2937066-012.patch3.34 KBstefan.korn
#9 core-inconsistent_breadcrumbs-2937066-009.patch2.58 KBstefan.korn
#6 inconsistent_breadcrumb_navigation_custom_block_library-2937066-006.patch8.6 KBstefan.korn
#2 inconsistent_breadcrumb_navigation_custom_block_library-2937066-001.patch1.33 KBstefan.korn
screen4.png49.67 KBstefan.korn
screen3.png43.82 KBstefan.korn
screen2.png50.9 KBstefan.korn
screen1.png49.63 KBstefan.korn

Comments

stefan.korn created an issue. See original summary.

stefan.korn’s picture

stefan.korn’s picture

Status: Active » Needs review

Status: Needs review » Needs work

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

stefan.korn’s picture

larowlan’s picture

Status: Needs work » Needs review
Issue tags: +Usability

The issue here is that by changing paths, we might be breaking things.

We can however, fix breadcrumbs without changing paths, by adding a new breadcrumb builder.

I think avoiding the BC break by adding a builder may be the path of least resistance.

Status: Needs review » Needs work
stefan.korn’s picture

Ok, seems to be a valid precaution not to changes paths, but adding Breadcrumb builder service.

And nice to hear about that service too ;-) Digging a little into this Breadcrumb builder service by looking here and there and finally got something working. So how about this patch as a first shot?

One thing I am not sure about is this addCacheableDependency(). Put it in because without it there seems to be a caching issue.

I am very open to improvements on this.

Just for the record:
I think the paths for the block content type administration are not consistent themselves, you have
admin/structure/block/block-content - for the custom blocks
admin/structure/block/block-content/types - for the custom block types
and then admin/structure/block/block-content/manage/{type} for managing the custom block types, this should be
admin/structure/block/block-content/types/manage/{type} imho. Then the breadcrumbs would be more consistent too without the need to add breadcrumb builder service.
But I am perfectly fine with changing only the breadcrumbs, because I think the breadcrumbs are the real UX deficit here, while the paths are more a "cosmetic" change and can be avoided if it is too risky breaking something.

stefan.korn’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: core-inconsistent_breadcrumbs-2937066-009.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

stefan.korn’s picture

Hm, trying to fix this test failure.

stefan.korn’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: core-inconsistent_breadcrumbs-2937066-012.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

stefan.korn’s picture

Status: Needs work » Needs review
StatusFileSize
new3.56 KB

One more try.

stefan.korn’s picture

larowlan’s picture

Status: Needs review » Needs work
Related issues: +#2501691: Change content-types, comment-types, and block-types URLs

This is looking great!

Some observations

  1. +++ b/core/modules/block_content/block_content.services.yml
    @@ -4,3 +4,7 @@ services:
    +      - { name: breadcrumb_builder, priority: 100}
    

    100 is quite high - if we do need 100, can we document in a comment in the services.yml why it is so high - i.e. Needs to be 100 to run before {some other service}.

    If not, lets make it something lower.

  2. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,43 @@
    +    if($route_match->getParameter('block_content_type')) {
    +      return TRUE;
    +    }
    

    This would match on /block/add/{block_content_type}, so we should probably just whitelist the routes we're dealing with. We can't know all routes that include {block_content_type} - there may be many in contrib.

  3. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,43 @@
    +    if($route_match->getRouteName() != 'entity.block_content_type.edit_form')
    +    {
    +      if($blocktype = $route_match->getCurrentRouteMatch()->getParameter('block_content_type')) {
    +        $breadcrumb->addLink(Link::createFromRoute($blocktype->label(), 'entity.block_content_type.edit_form', ['block_content_type' => $blocktype->id()]));
    +      }
    +    }
    

    Our coding standards require { to be on same line as the if

  4. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,43 @@
    +    $breadcrumb->addCacheableDependency(0);
    

    I don't think we need this.

    If there are caching issues, we should $breadcrumb->addCacheContexts(['url'])->addCaceableDependency($route_match->getParameter('block_content_type');

    I don't think 0 is a valid value

  5. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,43 @@
    \ No newline at end of file
    

    whitespace issue here

  6. +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
    @@ -120,8 +120,11 @@ public function testBlockContentTypeEditing() {
    +      'admin/structure/block/block-content/types' => 'Block types',
    

    Nice!

Also, I agree on the general question of changing the paths, we have #2501691: Change content-types, comment-types, and block-types URLs for that, as its a broader discussion covering other entity types too.

harsha012’s picture

StatusFileSize
new3.65 KB
new2.43 KB

Tried to fix some of the issue still setting this to NW.
fixed below points

  1. #17.3
  2. #17.4
  3. #17.5

Regarding the point #17.1 let #15 make a call on this.

stefan.korn’s picture

Ok, was busy for a few days. Now here a new version of the patch.

Tackling the observations of @larowlan (thanks for taking the time and quick response) as follows:

1. took the priority completely out. Seems to work without priority just like before. I do not have a special reason for the priority settings, took it out of some example.

2. I am open to whitelisting routes manually here and did already think about it and even used this in first steps towards this patch. But then I came to think about how to maybe get all relevant paths automatically and using parameter check therefore.
In a very basic scenario you have the tabs "Edit", "Manage fields", "Manage form display" and "Manage display". So now you work with translation, there comes a new tab "Translate custom block type". And then I am using devel module which brings a tab "Devel", and other contrib modules might bring there own tabs as well. So with checking for the parameter I get all the tabs without the need to whitelist routes like that for translation or even that for devel and any unknown modules that create tabs here.

And about

We can't know all routes that include {block_content_type} - there may be many in contrib

I was thinking about how a contrib module should use {block_content_type}. I think they maybe add a tab to the block content type, which would then be perfectly ok. But would they possibly also do some things with {block_content_type} completely out of the scope of the "Block types" section and would that be valid?
Regarding /block/add/{block_content_type}, yes I overlooked this. But how about improving this breadcrumb as well, see patch?
And for /admin/structure/block/block-content/manage/{block_content_type}/delete it also matches but it is delivering a reasonable breadcrumb here too.

So maybe if($route_match->getParameter('block_content_type')) { could be valid?

3. should now be fixed

4. it did not work with the line you gave, but it works with just$breadcrumb->addCacheContexts(['route']); - Took this out of some other BreadcrumdBuilder examples.

5. should now be fixed

6. thanks - making the tests work is sometimes the hardest part ...

stefan.korn’s picture

Status: Needs work » Needs review
larowlan’s picture

  1. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,48 @@
    +class BlockContentBreadcrumbBuilder implements BreadcrumbBuilderInterface {
    

    nit: this needs a class docblock

  2. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,48 @@
    +   * @@inheritdoc}
    ...
    +   * @@inheritdoc}
    

    nit - should be {@inheritdoc}

  3. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,48 @@
    +    if($route_match->getRouteName() == 'block_content.add_form') {
    ...
    +      if ($route_match->getRouteName() != 'entity.block_content_type.edit_form') {
    

    nit, these are string so we should be strict - i.e. === and !==

  4. +++ b/core/modules/block_content/src/BlockContentBreadcrumbBuilder.php
    @@ -0,0 +1,48 @@
    +      $breadcrumb->addLink(Link::createFromRoute($this->t('Add custom block'), 'block_content.add_page'));
    

    I am comfortable with that living inside the same trail, even though the path doesn't - but we should get sign off from the usability team. If we do it for /block/add/{type} then we would need to do it for /block/add too I think.

    Can you paste screenshots of the before/after for the main routes impacted by this patch, including block/add and block/add/{type} - that will make their review easier

stefan.korn’s picture

Ok, this is a patch which should hopefully fix the nits and add breadcrumb for block/add as well.

Screenshots will follow

stefan.korn’s picture

StatusFileSize
new45.69 KB
new50.7 KB
new57.4 KB
new53.51 KB
new52.68 KB

Please find screenshot of main routes that are affected by this patch below

Screenshot for the block/add route:
add/block route - before/after

Screenshot for the block/add/block_content_type route:
Screenshot add basic block - before/after

Screenshot for the delete block type route:
Delete Block type route - before/after

Screenshot for the edit block type route:
Screenshot edit block type route - before/after

Screenshot for the manage fields on block type route:
Screenshot Manage fields on block type - before/after

Status: Needs review » Needs work

The last submitted patch, 22: core-inconsistent_breadcrumbs-2937066-022.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

stefan.korn’s picture

Status: Needs work » Needs review
stefan.korn’s picture

Assigned: stefan.korn » Unassigned

Hi, is there anything else I should do on this?

The failed test was due to some general problem I think. I retested and it passed then.

larowlan’s picture

Can you provide an interdiff for #22 to save needing to re-review the whole patch.

If you don't have local branches and its going to be difficult, let me know and I'll review from scratch

stefan.korn’s picture

StatusFileSize
new3.28 KB
new2.33 KB

Ok, this is my first interdiff. So please check if this ok and bear with me if it's not ok.

I made two interdiffs, one between 15 and 22 and the other between 19 and 22. Please choose the one that is better for you.

larowlan’s picture

Issue tags: +Needs usability review

Code looks good to me, we just need the usability team to sign off on this, tagging for review.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

abhijith s’s picture

Patch #22 can't be applied in 9.2.x.Needs reroll.

Checking patch core/modules/block_content/block_content.services.yml...
Checking patch core/modules/block_content/src/BlockContentBreadcrumbBuilder.php...
Checking patch core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php...
error: while searching for:
    $front_page_path = Url::fromRoute('<front>')->toString();
    $this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [
      $front_page_path => 'Home',
      'admin/structure/block' => 'Block layout',
      'admin/structure/block/block-content' => 'Custom block library',
      'admin/structure/block/block-content/manage/basic' => 'Bar',
    ]);
    \Drupal::entityManager()->clearCachedFieldDefinitions();

error: patch failed: core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php:120
abhijith s’s picture

StatusFileSize
new1.59 KB

Rerolled patch #22.Please check it.

abhijith s’s picture

StatusFileSize
new3.95 KB

Fixed the CS issue

raman.b’s picture

StatusFileSize
new4.06 KB
new1.81 KB

Fixing the cspell issue and fixing a failing test case

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

So I am not seeing this with claro?

Is this a seven issue? If so this ticket may need to be moved to https://www.drupal.org/project/seven

stefan.korn’s picture

This issue is the same with Claro, it is not a Seven issue.

So, are you the maintainer that needs more info? I thought maintainer already given consent in #29, therefore wondering about the status "Postponed (maintainer needs more info)".

I suppose "usability review" is still needed and maybe one should try if patch still applies on latest HEAD.

stefan.korn’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new3.96 KB

made new patch against latest HEAD (9.5.x)

ranjith_kumar_k_u’s picture

StatusFileSize
new3.97 KB
new1.58 KB

Fixed CS errors.

Status: Needs review » Needs work

The last submitted patch, 45: 2937066-45.patch, failed testing. View results

ranjith_kumar_k_u’s picture

StatusFileSize
new4.04 KB
new757 bytes
ranjith_kumar_k_u’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

More info

You can follow https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-... for how to fill in the issue summary field.

Mainly
What are the steps to reproduce? Helps the reviewer and committer.
What's the proposed solution?

Also we will need a tests-only patch to verify that the tests are covering the issue.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed
Related issues: +#3318110: [meta] Reorganize Block items in the administration menu

This will be resolved when https://www.drupal.org/project/ideas/issues/3318110 lands.

stefan.korn’s picture

Okay then, let's linger this for another few years maybe. I am unfollowing this issue now, for the sake of my nerves.

aaronmchale’s picture

Issue tags: -Needs usability review

Removing the usability review tag, as the usability group is already focusing on fixing this problem as part of #3318110: [meta] Reorganize Block items in the administration menu and its child issues.

aaronmchale’s picture

Status: Postponed » Closed (outdated)
StatusFileSize
new21.17 KB

On review this issue (again), I'm closing it as outdated, because changes introduced to 10.1 in #2987964: Move custom block types admin link to admin/structure have inadvertently resolved this issue.

In 10.1, Block types have moved up to the top level of Structure, thus the breadcrumb now correctly takes you to the block types list:

Editing a block type, showing that the breadcrumb contains the block types listing page.