From 842f5298166d24b90e58c35544330c34cffe62cf Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Mon, 1 Dec 2025 11:03:23 -0600 Subject: [PATCH] fix(cls): APU tables layout + hero badges min-height MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - APU tables: Change media='print' to 'all' for immediate CSS loading - APU tables: Add table-layout: fixed to prevent column reflow - Hero: Add min-height: 40px to badge container to reserve space These changes prevent CLS caused by: 1. Delayed APU table CSS causing table layout shift 2. Hero category badges appearing after page load 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Assets/css/css-tablas-apu.css | 4 ++++ Inc/enqueue-scripts.php | 7 ++++--- Public/Hero/Infrastructure/Ui/HeroRenderer.php | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Assets/css/css-tablas-apu.css b/Assets/css/css-tablas-apu.css index 592fc2b4..e430c41c 100644 --- a/Assets/css/css-tablas-apu.css +++ b/Assets/css/css-tablas-apu.css @@ -28,6 +28,10 @@ border-radius: 8px; border: none; border-spacing: 0; + /* CRITICO: table-layout fixed previene CLS + El navegador calcula anchos basado en primera fila, + no recalcula cuando carga más contenido */ + table-layout: fixed; } /* Eliminar todos los bordes */ diff --git a/Inc/enqueue-scripts.php b/Inc/enqueue-scripts.php index ab7cddd6..ca1cfaed 100644 --- a/Inc/enqueue-scripts.php +++ b/Inc/enqueue-scripts.php @@ -562,17 +562,18 @@ add_action('wp_enqueue_scripts', 'roi_enqueue_theme_styles', 13); */ function roi_enqueue_apu_tables_styles() { // APU Tables CSS - // DIFERIDO: Fase 4.2 PageSpeed - below the fold + // CRITICO: Las tablas APU son contenido principal, CSS debe cargar inmediatamente + // para prevenir CLS (layout shift cuando estilos se aplican tarde) wp_enqueue_style( 'roi-tables-apu', get_template_directory_uri() . '/Assets/css/css-tablas-apu.css', array('roi-bootstrap'), ROI_VERSION, - 'print' // Diferido para no bloquear renderizado + 'all' // Critico: cargar inmediatamente para prevenir CLS ); } -add_action('wp_enqueue_scripts', 'roi_enqueue_apu_tables_styles', 15); +add_action('wp_enqueue_scripts', 'roi_enqueue_apu_tables_styles', 5); // Priority 5 = temprano /** * Enqueue APU Tables auto-class JavaScript diff --git a/Public/Hero/Infrastructure/Ui/HeroRenderer.php b/Public/Hero/Infrastructure/Ui/HeroRenderer.php index dd22803f..04389b3d 100644 --- a/Public/Hero/Infrastructure/Ui/HeroRenderer.php +++ b/Public/Hero/Infrastructure/Ui/HeroRenderer.php @@ -161,6 +161,11 @@ final class HeroRenderer implements RendererInterface 'min-height' => $titleMinHeight, ]); + // Contenedor de badges - altura minima para prevenir CLS + $cssRules[] = $this->cssGenerator->generate('.hero-section .mb-3.d-flex', [ + 'min-height' => '40px', + ]); + $cssRules[] = $this->cssGenerator->generate('.hero-section__badge', [ 'background' => $this->hexToRgba($badgeBgColor, 0.15), 'backdrop-filter' => "blur({$badgeBackdropBlur})",