Container has no addressable selectors or configurable markup

Created on 8 May 2023, over 1 year ago

EVAs are rendered inside entirely generic containers, making them difficult to arrange, style, or script properly.
Every EVA on a page is wrapped in container with markup

<div class="views-element-container contextual-region">

I've reviewed issues that suggest that the intended behavior is for containers to inherit from the view's CSS class, but that's not happening, hence filed as bug:
#2861480: Container is lacking semantic class β†’
πŸ› Markup differences, especially missing wrapper classes Fixed

Todo:
- Test
- Patch

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

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

Comments & Activities

  • Issue created by @AaronBauman
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

    Test only to demonstrate the missing CSS class on the views container

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    1 fail
  • Meaning it's not on the outer container, right? I think that was the original compromise, and your test seems to show that the custom class is appearing somewhere.

    If that's the case, the issue may be more that the handler-specified classes aren't where they usually are with other Views.

  • πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

    Yes, that's right. The outermost #theme_wrapper div doesn't any handler- or view-specific class. It's just a generic container.

    Here's a patch that uses hook_views_pre_render() to address it.

    I tried the same with \Drupal\views\Plugin\views\display\DisplayPluginBase::elementPreRender, but seems like that gets called after the container has already been rendered, because any changes to #theme_wrapper and #attributes in that context are ignored.

    After working through this, imo the container div is completely unnecessary, given the extensive wrapping elements already provided by views.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    4 pass
Production build 0.71.5 2024