localgovdrupal / localgov_base

The base theme for LocalGov Drupal websites.
8 stars 13 forks source link

Tabs / local tasks styling #116

Closed finnlewis closed 2 years ago

finnlewis commented 3 years ago

Hey @markconroy

Just testing creating child themes from the base theme and the local task tabs are not styled at all.

Is this known, by design or have I got something awry?

For example:

image

danchamp commented 3 years ago

@finnlewis Check your block config, Tabs should be in the Tabs region, and will render at the top of the page:

Screenshot 2021-08-10 at 21 23 06

The localgov profile places Tabs in content_top I think, which looks to be causing the issue:

https://github.com/localgovdrupal/localgov/blob/2.x/config/install/block.block.localgov_tabs.yml

finnlewis commented 3 years ago

Thanks @danchamp , that looks better!

So it looks like:

At the moment, we're still setting the default theme to localgov_theme in the profile, so when switching to the localgov_base theme the tabs end up in the wrong place.

Are we almost ready to switch to enabling the localgov_base theme or a localgov_base child theme by default?

If not, is there a way to set the block placements when we enable the theme?

danchamp commented 3 years ago

If not, is there a way to set the block placements when we enable the theme?

Yes, I think adding a config/install/block.block.tabs.yml file to the theme with this config should place the block correctly on theme install:

langcode: en
status: true
dependencies:
  theme:
    - localgov_base
id: tabs
theme: localgov_base
region: tabs
weight: 0
provider: null
plugin: local_tasks_block
settings:
  id: local_tasks_block
  label: Tabs
  provider: core
  label_display: '0'
  primary: true
  secondary: true
visibility: {  }

I can't test just now but will later if you don't beat me to it.

danchamp commented 3 years ago

@finnlewis From my testing it appears that if you define one block's placement in a theme's config, only that block is placed when the theme is installed and any other existing block placement is lost (even if there are regions in the theme that match those placements).

I guess this is expected behaviour (otherwise a theme couldn't define a set of blocks/regions) but means we need to include config for all blocks in the theme if we want to place the tabs block on install.

This may be moot - localgov_base must be very close to being ready to include by default in the profile, and once it is we can fix the block placement there.

How do we judge when it's ready? Current release is tagged as beta, is it when 1.0.0 is released?

markconroy commented 2 years ago

I created the new tabs region, so we'd have a unified approach to tabs across all LocalGov Drupal sites. And to make sure that tabs don't interfere with anything (like a hero) that might make use of absolutely positioned elements on the page. Tabs really shouldn't be part of the page order, so I placed them at the top.

The "no styling for tabs" issue is a very small issue at the moment while getting this ready for inclusion in the base distro. I don't think it's worth spending too much energy on it, when we have the simple workaround of manually placing tabs in the tabs region.

markconroy commented 2 years ago

This was taken care of in localgov profile: https://github.com/localgovdrupal/localgov/blob/2.x/config/install/block.block.localgov_tabs_base.yml