Drop the image description field
CI / Deploy / PHP 8.5 (push) Successful in 1m24s
CI / Deploy / PHP 8.4 (push) Successful in 1m27s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Skipped

Slide images are shown on the presenter's screen, so a description for
screen readers is not asked for any more. The column stays (always empty).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-15 13:59:33 +01:00
1 parent 33c75e504f
commit 4caff47a09
5 files changed
+7 -35

No files matched your search

+1 -1
View File
@@ -215,7 +215,7 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
Ablage `{Plenario.images.path}/{poll_id}/{24 Hex}.webp` (Standard `data/uploads`, Docker `/data/uploads`) **außerhalb von `webroot/`**,
ausgeliefert über `participate:image` (`/p/{code}/img/{file}`, auch für Presenter und Einbettung; nur Dateien dieser Umfrage, `immutable`
gecacht, kein Cookie). Jedes neue Bild bekommt einen neuen Namen → neue URL, ersetzte Bilder sind sofort 404.
Die Bildbeschreibung (`image_alt`) ist optional (leer = `alt=""`) und darf nie zur Ablehnung führen: das Dateifeld lässt sich nach einem Fehler nicht neu füllen. Layout `image_layout` (`top`|`side`|`full`, `full` nur
Eine Bildbeschreibung wird bewusst nicht abgefragt (`image_alt` bleibt `""`, die Spalte ist ungenutzt): Bilder sind Beamer-Dekoration. Nie Pflichtfelder zum Bild einführen, die den Upload verwerfen: das Dateifeld lässt sich nach einem Fehler nicht neu füllen. Layout `image_layout` (`top`|`side`|`full`, `full` nur
Inhaltsfolien, `null` = Standard je Typ: Inhaltsfolie `side`, sonst `top`; `Slide::imageLayout()`); `side` gilt nur für die Bühne
(CSS `stage--img-*`), Teilnehmende sehen das Bild immer oben (`element/slide_image`). Kontingent `Plenario.images.maxPerPoll` Folien mit Bild.
Im State steht `slide.image` = `{url, alt, layout, width, height}` (`PollStateService::slidePayload()`).
+2 -4
View File
@@ -415,12 +415,10 @@ class SlidesController extends AdminAppController
return $state;
}
// The description is optional (recommended for screen readers); empty means alt="" (skipped by them).
// Never reject an upload for it: the file input cannot be refilled after a failed save.
$alt = mb_substr(trim((string)($data['image_alt'] ?? '')), 0, Slide::IMAGE_ALT_MAX);
$layout = $data['image_layout'] ?? null;
$slide->patch([
'image_alt' => $alt,
// Presentation images are decoration: no description is asked for (alt="").
'image_alt' => '',
'image_layout' => in_array($layout, Slide::IMAGE_LAYOUTS, true) ? $layout : null,
], ['guard' => false]);
$this->setErrors($slide, $errors);
+1 -6
View File
@@ -20,7 +20,7 @@ use Cake\ORM\Entity;
* @property bool $is_hidden Prepared, but skipped in the presentation (never live)
* @property array<string, mixed>|null $settings
* @property string|null $image File name of the slide image in the poll's upload directory (see ImageService)
* @property string|null $image_alt Alternative text of the image, '' = decorative
* @property string|null $image_alt Always '' (decorative): images are shown on the stage, no description is asked for
* @property string|null $image_layout top|side|full, null = default of the type (see imageLayout())
* @property int|null $image_width Pixels of the stored (scaled) image
* @property int|null $image_height
@@ -149,11 +149,6 @@ class Slide extends Entity
public const IMAGE_FULL = 'full';
public const IMAGE_LAYOUTS = [self::IMAGE_TOP, self::IMAGE_SIDE, self::IMAGE_FULL];
/**
* Longest alternative text.
*/
public const IMAGE_ALT_MAX = 255;
/**
* @var array<string, bool>
*/
-8
View File
@@ -19,7 +19,6 @@ $request = $this->getRequest();
$posted = $request->is(['post', 'put', 'patch']);
$hasImage = $slide->hasImage();
// After a failed save the posted values are shown again.
$alt = $posted ? (string)$request->getData('image_alt', '') : (string)$slide->image_alt;
$layout = $posted && in_array($request->getData('image_layout'), Slide::IMAGE_LAYOUTS, true)
? (string)$request->getData('image_layout')
: $slide->imageLayout();
@@ -72,13 +71,6 @@ $maxMb = (int)round((int)Configure::read('Plenario.images.maxUploadBytes', 10 *
<div class="error-message" id="image-error"><?= h(implode(' ', (array)$imageError)) ?></div>
<?php endif; ?>
</div>
<div class="input text">
<label for="image-alt"><?= __('Bildbeschreibung (optional)') ?></label>
<input type="text" id="image-alt" name="image_alt" maxlength="<?= Slide::IMAGE_ALT_MAX ?>" autocomplete="off"
value="<?= h($alt) ?>" placeholder="<?= h(__('z. B. Organigramm des Vereins')) ?>"
aria-describedby="image-alt-hint">
<p class="hint" id="image-alt-hint"><?= __('Kurz beschreiben, was zu sehen ist. Das hilft Menschen, die einen Screenreader nutzen. Leer lassen, wenn das Bild nur Dekoration ist.') ?></p>
</div>
<fieldset class="scale-style image-fields__layout">
<legend><?= __('Platzierung in der Präsentation') ?></legend>
<?= $this->Form->radio('image_layout', array_map(
+3 -16
View File
@@ -48,7 +48,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/add?type=content", $data + [
'type' => 'content',
'question' => 'Mit Bild',
'image_alt' => 'Ein roter Kreis',
], $this->makeImage(3000, 2000));
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->first();
@@ -62,7 +61,6 @@ class SlideImageTest extends TestCase
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
$this->assertNotNull($slide);
$this->assertTrue($slide->hasImage());
$this->assertSame('Ein roter Kreis', $slide->image_alt);
$this->assertSame([1600, 1067], [$slide->image_width, $slide->image_height]);
$this->assertSame(Slide::IMAGE_FULL, $slide->imageLayout());
$this->assertSame([$slide->image], $this->storedImages($poll->id));
@@ -77,7 +75,7 @@ class SlideImageTest extends TestCase
$this->assertSame(Slide::IMAGE_TOP, $choice->imageLayout(), 'full exists for content slides only');
}
public function testImageDescriptionIsOptional(): void
public function testNoDescriptionIsNeeded(): void
{
[$poll, $token] = $this->createPoll();
$this->postWithImage("/admin/$token/slides/add?type=content", [
@@ -102,7 +100,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/add?type=content", [
'type' => 'content',
'question' => 'Kein Bild',
'image_alt' => 'x',
], $path, UPLOAD_ERR_OK, 'text.jpg');
$this->assertResponseContains('JPEG, PNG, WebP oder GIF');
@@ -116,7 +113,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/{$slide->id}/edit", [
'question' => '',
'image_alt' => 'neu',
], $this->makeImage(100, 100));
$this->assertResponseContains('Bitte prüfe deine Eingaben');
@@ -132,7 +128,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/add?type=content", [
'type' => 'content',
'question' => 'Zweites Bild',
'image_alt' => 'x',
], $this->makeImage());
$this->assertResponseContains('höchstens 1 Folien mit Bild');
@@ -147,7 +142,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/{$slide->id}/edit", [
'question' => 'Mit Bild',
'image_alt' => 'Neu',
], $this->makeImage(300, 200));
$slide = $this->slidesTable()->get($slide->id);
@@ -162,13 +156,11 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/{$slide->id}/edit", [
'question' => 'Mit Bild',
'image_alt' => 'Anderer Text',
'image_layout' => 'top',
], $this->makeImage(), UPLOAD_ERR_NO_FILE);
$after = $this->slidesTable()->get($slide->id);
$this->assertSame($slide->image, $after->image);
$this->assertSame('Anderer Text', $after->image_alt);
$this->assertSame(Slide::IMAGE_TOP, $after->imageLayout());
$this->assertSame([$slide->image], $this->storedImages($poll->id));
}
@@ -182,7 +174,6 @@ class SlideImageTest extends TestCase
$after = $this->slidesTable()->get($slide->id);
$this->assertFalse($after->hasImage());
$this->assertNull($after->image_alt);
$this->assertSame([], $this->storedImages($poll->id));
}
@@ -205,7 +196,6 @@ class SlideImageTest extends TestCase
$this->postWithImage("/admin/$token/slides/add?type=content", [
'type' => 'content',
'question' => 'Zweites',
'image_alt' => 'x',
], $this->makeImage());
$this->assertCount(2, $this->storedImages($poll->id));
@@ -225,7 +215,6 @@ class SlideImageTest extends TestCase
$copy = $slides[1];
$this->assertTrue($copy->hasImage());
$this->assertNotSame($slide->image, $copy->image);
$this->assertSame('Ein roter Kreis', $copy->image_alt);
$this->assertSame(Slide::IMAGE_TOP, $copy->imageLayout());
$this->assertCount(2, $this->storedImages($poll->id));
@@ -279,7 +268,6 @@ class SlideImageTest extends TestCase
$old = $slide->image;
$this->postWithImage("/admin/$token/slides/{$slide->id}/edit", [
'question' => 'Mit Bild',
'image_alt' => 'Neu',
], $this->makeImage(300, 200));
$this->get(['_name' => 'participate:image', 'code' => $poll->join_code, 'file' => $old]);
@@ -294,14 +282,14 @@ class SlideImageTest extends TestCase
$this->get("/admin/$token/state");
$payload = json_decode((string)$this->_response->getBody(), true)['slide'];
$this->assertSame('Ein roter Kreis', $payload['image']['alt']);
$this->assertSame('', $payload['image']['alt']);
$this->assertSame('side', $payload['image']['layout']);
$this->assertSame("/p/{$poll->join_code}/img/{$slide->image}", $payload['image']['url']);
$this->get('/p/' . $poll->join_code);
$this->assertResponseOk();
$this->assertResponseContains('/p/' . $poll->join_code . '/img/' . $slide->image);
$this->assertResponseContains('alt="Ein roter Kreis"');
$this->assertResponseContains('alt=""');
$this->assertResponseContains('width="1600" height="1067"');
}
@@ -325,7 +313,6 @@ class SlideImageTest extends TestCase
$this->assertResponseOk();
$this->assertResponseContains('enctype="multipart/form-data"');
$this->assertResponseContains('name="remove_image"');
$this->assertResponseContains('value="Ein roter Kreis"');
$this->assertResponseContains('Bildschirm füllen');
}
}