Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Closes #1406 - Sidebar nav changes #1835

Closed
wants to merge 5 commits into from
Closed

[WIP] Closes #1406 - Sidebar nav changes #1835

wants to merge 5 commits into from

Conversation

akslay
Copy link
Contributor

@akslay akslay commented Aug 10, 2022

Description

In an effort to improve content hierarchy (page title and secondary sidebar content), this PR moves the sidebar nav to the sidebar_second region, hides the sidebar nav on mobile (in favor of the off-canvas experience), eliminates the sidebar nav's h2 margin-top, and consolidates sidebar mobile breakpoints to match the mobile nav breakpoint.

Review site: https://7b5e2985-cedf-4a13-ab91-3a35916c835d--pr-1835.probo.build/

Related issues

Closes #1406

Related to #1834

How to test

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@akslay akslay added enhancement New feature or request visual change Introduces a visual change labels Aug 10, 2022
@akslay akslay self-assigned this Aug 10, 2022
@akslay akslay requested a review from a team as a code owner August 10, 2022 22:50
Copy link
Member

@joeparsons joeparsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

joeparsons
joeparsons previously approved these changes Aug 10, 2022
Copy link
Contributor

@joshuasosa joshuasosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sidebar navigation supports unlimited levels. It doesn't look like the offcanvas nav is taking that into account.

Example on probo: https://7b5e2985-cedf-4a13-ab91-3a35916c835d--pr-1835.probo.build/pages/text

Example of more nav levels

image

Nav levels missing from mobile

image

Additionally, the lack of top margin for the navigation looks bad in my opinion.

But nice to see the navigation move to second sidebar. Since most of our users read left to right, my department considered the main page text to be most important text to read first and has had sidebar navigation on the right for many years.

@akslay
Copy link
Contributor Author

akslay commented Aug 12, 2022

I believe the increase of levels in the off-canvas nav is happening in a separate PR that will be related to the design mockups that are coming from the designers. Is that correct @danahertzberg ?

@danahertzberg
Copy link
Contributor

I believe the increase of levels in the off-canvas nav is happening in a separate PR that will be related to the design mockups that are coming from the designers. Is that correct @danahertzberg ?

Yes, this is correct

@danahertzberg
Copy link
Contributor

I'm personally conflicted between adding or removing top margin.

Please wait to merge until we run by leadership.

@akslay
Copy link
Contributor Author

akslay commented Aug 12, 2022

It sounds like more workshop time needs to happen with this topic; there's some conflicting opinions on sidebar nav placement we should hash out. Going to postpone this PR until we can discuss it in another workshop.

I also think it would be a good idea to remove the "hide on mobile" for the sidebar nav from this PR and instead add it to the PR that addresses adding more tiers to the off-canvas mobile nav. This PR should focus on moving (if still applicable after 2nd round group discussion) the block only.

@Carris-Toupin
Copy link
Contributor

We need to compile a list of sites that might be negatively impacted by this 'automatic' change in sidebar position.

@joshuasosa
Copy link
Contributor

This PR should focus on moving (if still applicable after 2nd round group discussion) the block only.

Sounds good!

Perhaps changes like moving sidbar nav to the right and/or removing top margin could be done for 'new' sites while 'existing' sites could keep things relatively as-is to reduce the potential for negative impact. For margin, that could mean using an update to put in an mt-4 or mt-5 for existing sites while keeping the default empty for new sites.

@trackleft
Copy link
Member

Blocks or should be merged together with #1834 if merged.

@akslay
Copy link
Contributor Author

akslay commented Aug 17, 2022

Bringing over Dana's comments from the issue to the PR:

To reduce impact on existing sites and to marry nicely with the page title region changes, this ticket will only require removing the sidebar nav's block title top margin. By changing mt-md-5 to mt-0.

<h2{{ title_attributes.setAttribute('id', heading_id).addClass('h4').addClass('mt-md-5') }}>{{ configuration.label }}</h2>

Also keep Ashley's updates to match region breakpoints to mobile nav breakpoints.

@akslay akslay dismissed joshuasosa’s stale review August 17, 2022 23:19

PR requirements have changed

@akslay
Copy link
Contributor Author

akslay commented Aug 17, 2022

PR is updated with latest requirement changes and is ready for re-review and/or approvals.

@@ -46,7 +46,7 @@
{% set title_attributes = title_attributes.addClass('sr-only') %}
{% endif %}
{{ title_prefix }}
<h2{{ title_attributes.setAttribute('id', heading_id).addClass('h4').addClass('mt-md-5') }}>{{ configuration.label }}</h2>
<h2{{ title_attributes.setAttribute('id', heading_id).addClass('h4').addClass('mt-0') }}>{{ configuration.label }}</h2>
Copy link
Contributor

@joshuasosa joshuasosa Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change immediately affects existing sites. Please change to only affect new sites. If the idea is that such an update would come in another issue/PR, then this PR will be blocked until that is implemented.

Copy link
Member

@trackleft trackleft Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll supply a patch so we can test this in combination with the #1834 so we can test this easily on existing sites and figure out a way to do the least amount of harm.

I can't think of a way to only affect existing sites, without rewriting this template a bit first.
Steps would be:

  • Move the added classes into a theme setting. mt-0
  • Add an update that adds the configuration setting, and sets it to what it was before this change. mt-md-5

Not 100% sure that this will work ☝️ , so will need to test it.

The theory is that config distro will skip a changed value if using the merge strategy.

Copy link
Member

@trackleft trackleft Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, we can update this setting in bulk via drush on any sites we deem safe, after this.

Copy link
Member

@trackleft trackleft Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course this will most likely be a problem for any sites that have a sub theme with an overridden template and those added classes changed and are using {{title_attributes}}. Unless we don't add classes to title attributes in the .theme file, and instead add the classes to title_attributes within this template.

@trackleft
Copy link
Member

trackleft commented Aug 18, 2022

Patch for testing on existing sites. Add this to you're site specific composer.json.

"extra": {
    "patches": {
       "az-digital/az_quickstart": {
          "test https://github.com/az-digital/az_quickstart/pull/1834" : "https://patch-diff.githubusercontent.com/raw/az-digital/az_quickstart/pull/1834.diff",
          "test https://github.com/az-digital/az_quickstart/pull/1835" : "https://patch-diff.githubusercontent.com/raw/az-digital/az_quickstart/pull/1835.diff"
    }
  }
}

Run composer update

Run drush cr

Do not commit this to your main/master branch. Or add this to your live site, this should be throwaway code.

@trackleft
Copy link
Member

trackleft commented Aug 18, 2022

Something like

/**
 * Add sidebar block classes to config, and setting it to a value that won't break existing sites.
 */
function az_quickstart_update_920104() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory->getEditable('az_barrio.settings');
  $config->set('sidebar_menu_classes', ['h4', 'mt-md-5']);
  $config->save(TRUE);
}

@danahertzberg
Copy link
Contributor

@Carris-Toupin

To get comparison screenshots of existing sites in a multidev:

  1. Move page title block to content top region
  2. Change margin top in inspector from mt-md-5 to mt-0
    a. On h2 element of sidebar nav title
    image
  3. View page comparisons/capture screenshots not logged in
  4. Put screenshots in Google Slides and share link on this PR

@joshuasosa
Copy link
Contributor

Couple comparisons per Dana's suggestion above.

The nav menu without top margin puts it right against the text on media, which doesn't look good.

Nav with top margin

screencapture-azqs-ddev-site-pages-test-2022-08-19-16_33_02

Nav without top margin

screencapture-azqs-ddev-site-pages-test-2022-08-19-16_33_41

@danahertzberg
Copy link
Contributor

In this specific example, the page content can be modified to get the desired look. Add bottom spacing to the Text on Media paragraph, and add the mt-0 class to the H2 element.

It will be important to see the distribution of how this change will look on various sites to determine impact.

@Carris-Toupin
Copy link
Contributor

@danahertzberg
Copy link
Contributor

danahertzberg commented Sep 7, 2022

Potential path forward:

  • Change template from mt-md-5 to mt-0 (keep as it currently is)
  • Put mt-md-5 class into block CSS class(es) field with db update

This requires many configuration changes that are fragile.

Will continue discussions int he workshop. Need more research on impact.

@trackleft
Copy link
Member

Add default theme setting for block title margin class
Set the default to existing setting for existing sites
Set the default to new setting for new sites
Inform per block setting from theme setting and allow override.

@akslay akslay assigned danahertzberg and unassigned akslay May 31, 2023
@joeparsons joeparsons added the needs discussion Further discussion required to determine requirements label Aug 4, 2023
@danahertzberg danahertzberg marked this pull request as draft September 22, 2023 17:04
@danahertzberg danahertzberg changed the title Closes #1406 - Sidebar nav changes [WIP] Closes #1406 - Sidebar nav changes Sep 22, 2023
@danahertzberg
Copy link
Contributor

This may need to be revisited with the upcoming navigation changes led by central MarCom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7.x only blocker enhancement New feature or request needs discussion Further discussion required to determine requirements visual change Introduces a visual change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidebar nav block config updates
6 participants