diff --git a/components/ILIAS/UI/src/Implementation/Component/Input/Field/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/Input/Field/Renderer.php index eb592d872722..73a13df1e3d0 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Input/Field/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/Input/Field/Renderer.php @@ -919,7 +919,9 @@ protected function renderFilePreview( ): Template { $template->setCurrentBlock('block_file_preview'); $template->setVariable('REMOVAL_GLYPH', $default_renderer->render( - $this->getUIFactory()->symbol()->glyph()->close()->withAction("#") + $this->getUIFactory()->button()->shy('', '#') + ->withSymbol($this->getUIFactory()->symbol()->glyph()->close()) + ->withAriaLabel('close') )); if (null !== $file_info) { diff --git a/components/ILIAS/UI/tests/Component/Input/Field/FileInputTest.php b/components/ILIAS/UI/tests/Component/Input/Field/FileInputTest.php index ca31d8d3e960..396596201df7 100755 --- a/components/ILIAS/UI/tests/Component/Input/Field/FileInputTest.php +++ b/components/ILIAS/UI/tests/Component/Input/Field/FileInputTest.php @@ -71,6 +71,19 @@ protected function brutallyTrimHTML(string $html): string return parent::brutallyTrimHTML($html); } + private function getCloseButtonHtml(string $id): string + { + $html = $this->brutallyTrimHTML( + $this->getDefaultRenderer()->render( + $this->getUIFactory()->button()->shy('', '#') + ->withSymbol($this->getUIFactory()->symbol()->glyph()->close()) + ->withAriaLabel('close') + ) + ); + + return str_replace('id="id_1"', 'id="' . $id . '"', $html); + } + private function getUploadHandler(?FileInfoResult $file = null): Field\UploadHandler { return new class ($file) implements Field\UploadHandler { @@ -146,21 +159,21 @@ public function testRender(): void $label = "label"; $byline = "byline"; $file_input = $f->file($this->getUploadHandler(), $label, $byline)->withNameFrom($this->name_source); + $close_button = $this->getCloseButtonHtml('id_1'); $expected = $this->getFormWrappedHtml( 'file-field-input', $label, - ' + <<