Hello and welcome
the svg
helper doesn’t actually do any interpretation of the passed file, you can think of it more like a helper in simply finding the file: you can pass it a File object, a site relative path or an absolute one.
Once it finds the file, it simply returns its content, without any parsing.
Like, it also doesn’t remove an eventual XML declaration (<?xml version="1.0" encoding="UTF-8" ?>
) which would be ignored when embedded in HTML.
If you need the SVG to be accessible, I think the easiest would be to start with an accessible SVG. Otherwise you’d have to do the parsing yourself, which might not be so trivial:
<?php
$el = new SimpleXMLElement(svg($logo));
$el['role'] = 'img';
$el['aria-labelledby'] = 'element-id';
echo explode("\n", $file->asXML(), 2)[1];
?>