Masonry layout can break if there are multiple displays of the same view on the same page

Created on 12 December 2023, about 1 year ago

Problem/Motivation

The masonry layout can break if there are multiple displays of the same view on the same page, because the css selector for the container is solely based on the view id. It may only be evident if some displays have grouping and others don't.

Steps to reproduce

Install masonry views,
Create a view with multiple block displays, each with a masonry format. Place all blocks on the same page.

Proposed resolution

Update the container selector defined in masonry_views_preprocess_views_view_masonry and applied in masonry_views_preprocess_views_view to include the current display.

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇳🇿New Zealand somatick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @somatick
  • 🇳🇿New Zealand somatick

    Patch attached which adds current display to the container class name

  • 🇳🇿New Zealand somatick

    Oops I didn't notice the .txt extension when I saved locally. Same patch

  • Status changed to Needs review about 1 year ago
  • 🇳🇿New Zealand chroid

    Thanks @somatick!

    Have tested this on a development site of ours and can confirm the patch applies cleanly and resolves the layout issues we were facing for multiple blocks of the same view on the page!

Production build 0.71.5 2024