[6.x]: An image whose asset has no alt text is output with the asset's URL as alt
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- accessibility, backend
Línea de trabajo
Start by reading the asset reference construction in resources/assets/ckeditor/src/image/imageinsert/imageinsertui.js and the referenced resolution logic in Craft CMS's src/Element/Operations/ElementRefs.php. Trace how an empty alt value becomes a reference and check the relevant tests for reference resolution. Done means an image asset with no alternative text outputs alt="", while an asset with alternative text outputs that text.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
In 6.0.0-beta.2, an image inserted from an asset that has no alternative text is output with the asset's URL as its alt attribute.
The editor marks the alt text with an asset reference, also when the asset has none:
// resources/assets/ckeditor/src/image/imageinsert/imageinsertui.js
const alt = `${asset.alt ?? ''}#asset:${asset.id}${siteId ? `@${siteId}` : ''}:alt`;
On save, craftcms/html-field 4.0.0 turns that into a reference tag (HtmlField.php, "Find any alt text element refs and swap them with ref tags"): alt="{asset:18@2:alt}", with ||<text> when there was text.
When the tag is resolved, Craft returns the element's URL for an attribute that is not set:
// craftcms/cms, src/Element/Operations/ElementRefs.php (6.x-dev at 3c73751)
if (empty($attribute) || ! isset($element->$attribute)) {
return (string) $element->getUrl();
}
$asset->alt is null, so {asset:18@2:alt} resolves to the file's URL.
Steps to reproduce
- Craft 6.x-dev with
craftcms/ckeditor6.0.0-beta.2, a volume, and an image asset whose Alternative Text is empty. - A CKEditor field with the "Insert image" button on an entry type; create an entry and insert the asset from the toolbar. Save.
- Output the field in a template, and look at the stored value.
Expected behavior
alt="", or the alt text once the asset has one.
Actual behavior
Stored:
<figure class="image"><img src="{asset:18:url||http://127.0.0.1:8097/storage/spike/spike-photo.png}" alt="{asset:18@2:alt||http://127.0.0.1:8097/storage/spike/spike-photo.png}" width="320" height="200" /></figure>
Output: the image carries alt="http://127.0.0.1:8097/storage/spike/spike-photo.png".
A screen reader reads the URL aloud for every such image.
Versions
craftcms/ckeditor6.0.0-beta.2,craftcms/html-field4.0.0craftcms/cms6.x-devat 3c73751914389c1cde559d77a28ecf33265cb820- PHP 8.5.4, PostgreSQL 18, Ubuntu 26.04
- Lenguaje dominante
- PHP
- Estrellas
- 47
- Forks
- 35
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 25
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de craftcms/ckeditor
-
repo:ckeditor
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
craftcms/ckeditor#682 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[6.x] Inline styles (alignment, font color, background color) are stripped on savePosiblemente ocupada @i-just la tomó hoy. Abiertorepo:ckeditor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
craftcms/ckeditor#676 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
bug repo:ckeditor
Dificultad 3/5 1-2 días Aptitud para principiantes 40/100
craftcms/ckeditor#665 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[6.x]: Esc in a fullscreen CKEditor field closes Preview instead of leaving fullscreenPosiblemente ocupada @i-just la tomó hace 15 días. Abiertobug repo:ckeditor
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
craftcms/ckeditor#651 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
bug repo:ckeditor
Dificultad 3/5 1-2 días Aptitud para principiantes 54/100
craftcms/ckeditor#646 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de craftcms/ckeditor
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Codeinwp/optimole-wp#1259 ·
Los mantenedores suelen responder en 1 día
-
component/core domain/framework
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100