House ad not centered in topic-list-between (left-aligned)

Summary

House ads rendered in the topic-list-between placement are no longer centered across the topic list width. Instead, they appear left-aligned (confined to the first column area). This looks like a regression caused by making the house-ad component tagless, which breaks table semantics.


Steps to Reproduce

  1. Go to Admin → Plugins → Ads
  2. Create a House Ad
  3. Enable it for placement: topic-list-between
  4. Visit the homepage (or any topic list using the standard table layout)
  5. Observe the house ad alignment

Expected Behavior

The house ad should render centered across the full width of the topic list (spanning all columns), as it did previously.


Actual Behavior

The house ad is left-aligned and only occupies the left portion of the table (roughly the “topic title” column space), rather than spanning the row.


Technical Analysis

This appears to be caused by invalid table markup produced by the house-ad component.

File:
plugins/discourse-adplugin/assets/javascripts/discourse/components/house-ad.gjs

The component is tagless:

@tagName("")
export default class HouseAd extends AdComponent {

But it renders a div with a colspan attribute:

<div
  colspan={{this.colspanAttribute}}
  class={{concatClass "house-creative" this.adUnitClass}}
  ...attributes
>

Why this breaks

  • colspan only works on <td> / <th>, not on <div>.
  • In the topic list table, this ends up as a <div> directly inside a <tr>, which is invalid HTML and causes the browser to lay it out incorrectly (typically collapsing it into the first column region).
  • The colspanAttribute() logic checks this.tagName === "td" (or equivalent), but since the component is tagless, it never becomes "td", so colspan is effectively never applied.

Likely Regression Source

This seems introduced by the “tagless components” lint enforcement / refactor (the change that converted components to tagless), which unintentionally broke components that must render as real table cells in certain connectors/placements.


Environment

  • Discourse version: latest (tests-passed)
  • Ad plugin: built-in discourse-adplugin
  • Browsers tested: Chrome + Firefox (appears browser-agnostic)

1 Like