]> _ Git - fluidbook_tools.git/commitdiff
wip #7894 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Jan 2026 16:56:21 +0000 (17:56 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 14 Jan 2026 16:56:21 +0000 (17:56 +0100)
src/Compiler/CompilerInterface.php
src/Compiler/DummyCompiler.php
src/Links/HTMLMultimediaImage.php
src/Links/Link.php

index 3a081f54c6bb1d29cc1baf01451c9a823d07dfaf..60059d16c758dcf45091d1d2a1988a162323e636 100644 (file)
@@ -82,4 +82,6 @@ interface CompilerInterface
     public function extractPDFArea($file, $page, $rect, $to=null, $options = array(), $cache = null);
 
     public function addMask($layer, $page, $area);
+
+    public function getLinkAlternativeText($link);
 }
index 4e469acd871bf653c2c4c6584609e8b5acb7fc26..b43e73c22096e8673d628d7c2a4fa7840e984ac8 100644 (file)
@@ -174,4 +174,9 @@ class DummyCompiler implements CompilerInterface {
     {
         // TODO: Implement addMask() method.
     }
+
+    public function getLinkAlternativeText($link)
+    {
+        // TODO: Implement getLinkAlternativeText() method.
+    }
 }
index 45666300208f8fc4abef7b868baf8c28f9925cbf..70335787c97abbe38cd87723d33a0fb6928ce16f 100644 (file)
@@ -16,13 +16,16 @@ class HTMLMultimediaImage extends Link
         $w = $this->width;
         $h = $this->height;
         $this->copyExternalFile($this->to);
-        $alt = '<img class="multimediaimage" data-scroll="' . $this->scroll . '" data-width="' . $w . '" data-height="' . $h . '" src="' . Link::getUniversalLocation($this->to) . '" width="' . $w . '" height="' . $h . '" />';
-        return $alt;
+        $res = '<img class="multimediaimage" data-scroll="' . $this->scroll . '" data-width="' . $w . '" data-height="' . $h . '" src="' . Link::getUniversalLocation($this->to) . '" width="' . $w . '" height="' . $h . '" aria-hidden="1" />';
+        $alt=$this->getAlternativeText();
+        if($alt) {
+            $res .= '<div class="accessible" aria-live="polite">' . $alt . '</div>';
+        }
+        return $res;
     }
 
     public function getAdditionnalContent()
     {
         return parent::getAdditionnalContent() . ' aria-hidden="true" data-scroll="' . $this->scroll . '" ';
     }
-
 }
index f68b3ed0df4ce0052483205fad05310f4520d2d3..4c9dab471768f195b5763ddc3a28bd607d1335c9 100644 (file)
@@ -1195,4 +1195,9 @@ class Link
     {
         return $this->animation_type == '1' || $this->display_area === 'default' ? $this->compiler->getSetting('linksDisplayArea', 'fill') : $this->display_area;
     }
+
+    public function getAlternativeText()
+    {
+        return $this->alt ?: $this->compiler->getLinkAlternativeText($this);
+    }
 }