fix(css): eliminate double @media in blog visual float layout - #1157
Conversation
news-article-page__media--layout-float delegated to news-article-page__media--offset-right, which already guards offset-content--offset-right behind @media (--medium-and-above). Wrapping the mixin call in a second @media (--medium-and-above) produced nested duplicate at-rules in compiled output. Inline the offset-content mixins directly inside layout-float with a single guard, and restructure the blog-visual rule block to nest @media inside selectors (not selectors inside @media). Co-authored-by: Cursor <cursoragent@cursor.com>
Review Summary by QodoEliminate double @media in blog visual float layout
WalkthroughsDescription• Eliminate duplicate nested @media queries in blog visual layout • Inline offset-content mixins directly in layout-float mixin • Restructure selectors to nest @media inside instead of outside • Prevent compiled CSS from generating redundant media query nesting Diagramflowchart LR
A["news-article-page__media--layout-float<br/>delegated to offset-right"] -->|"Remove delegation"| B["Inline offset-content<br/>mixins directly"]
B -->|"Single @media guard"| C["Restructured CSS<br/>output"]
D["Selectors inside @media"] -->|"Refactor to"| E["@media inside<br/>selectors"]
C -->|"Result"| F["No duplicate<br/>@media nesting"]
File Changes1. taccsite_cms/static/site_cms/css/src/_imports/components/django.cms.blog.app.css
|
Code Review by Qodo
1. Unscoped figcaption padding
|
wesleyboar
left a comment
There was a problem hiding this comment.
Notes for human reviewers.
| @media (--medium-and-below) { | ||
| & { | ||
| & { | ||
| @media (--medium-and-below) { | ||
| @mixin news-article-page__media--layout-center; | ||
| } | ||
| } | ||
| @media (--medium-and-above) { | ||
| &:has([data-width="0"]) { | ||
| &:has([data-width="0"]) { | ||
| @media (--medium-and-above) { |
There was a problem hiding this comment.
These first two changes are just cosmetic no-op refactor solely to mirror syntax of the functional change below.
| &:not(:has([data-width="0"])) { | ||
| @mixin news-article-page__media--layout-float; | ||
| } | ||
| } | ||
| &:not(:has([data-width="0"])) { | ||
| @mixin news-article-page__media--layout-float; |
There was a problem hiding this comment.
This is a functional change. I take mixin out of the @media (--medium-and-above) { in the code above where it had been a parent ruleset.
That @media (--medium-and-above) { will be inserted isntead into the news-article-page__media--layout-float mixin in the other file I changed.
| @define-mixin news-article-page__media--layout-float { | ||
| @mixin news-article-page__media--offset-right; | ||
| @media (--medium-and-above) { | ||
| @mixin offset-content; | ||
| @mixin offset-content--float-right; | ||
| @mixin offset-content--terminate-offset-right; | ||
| @mixin offset-content--offset-right; | ||
| } | ||
| @mixin news-article-page__media--offset__figcaption; | ||
| } |
There was a problem hiding this comment.
Instead of (A) having a @media both outside the rule that uses this mixin and inside the mixin that this mixin includes, I now (B) have the @media only directly inside this mixin.
This prevents nested the @media.
Co-authored-by: Cursor <cursoragent@cursor.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
## Overview `news-article-page__media--offset__figcaption` applied `padding-right: 125px` to `.figure .figure-caption` but: - its selector can never match in practice - if matched, causes unwanted style[^1] [^1]: Seems to be cruft from older version of Texascale. I reproduced the style in Core-CMS, where it looks like a bug. New and old Texascale don't have markup that will be affected by this change. ## Related - noticed during #1157 ## Changes - **deleted** `news-article-page__media--offset__figcaption` mixin ## Testing No visible change expected — the selector never matched reachable markup. ## UI N/A ## Notes The selector `&.figure .figure-caption` requires an element to simultaneously carry a CMS align class (`.align-right` / `.align-left`) and Bootstrap's `.figure` class, with a `.figure-caption` descendant. This combination cannot be produced through the Text plugin, which is how article body content is authored. Older Texascale editions that did use Bootstrap figures predated this code. Newer websites work exclusively inside the Text plugin, which cannot produce Bootstrap figure markup. The original `???:` comment in the mixin already signaled uncertainty about whether it ever applied. And if the code appeared, it would have unwanted padding because of this code (I tested manually). Made with [Cursor](https://cursor.com). Co-authored-by: Cursor <cursoragent@cursor.com>
Overview
A mixin calling another mixin that already contained
@media (--medium-and-above)produced duplicate nested at-rules in compiled CSS.Related
Changes
@mediain compiled output for.blog-visualfloat layout.blog-visualrule block for consistent nesting conventionTesting
make start@media (min-width: 992px)nesting in compiled CSS.UI
…