Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect warnings for svg in epubcheck 4.0.1 #680

Closed
kevinhendricks opened this issue Mar 7, 2016 · 7 comments
Closed

Incorrect warnings for svg in epubcheck 4.0.1 #680

kevinhendricks opened this issue Mar 7, 2016 · 7 comments
Labels
status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Milestone

Comments

@kevinhendricks
Copy link

Now that Sigil has added support for epub3, I have started to receive bugs related to user's epub3 ebooks not passing epubcheck and asking questions about what the "warnings" are for.

According to a Sigil bug report, the following warning - ACC_011 is reported by epubcheck 4.0.1 (via Pagina) for this snippet of code.

"SVG hyperlinks should have a human-readable title (using the 'title' child element or the 'xlink:title' attribute)"

 <div class="svg_outer">
    <div class="svg_inner">
      <svg height="94%" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 1800" preserveAspectRatio="xMidYMid meet" width="94%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="1800" id="title-original" width="1200" xlink:href="../Images/walden-titlepage.jpg"/></svg>
  </div>
</div>

After searching the epubcheck code for ACC_011 I see it when handling svg "anchor" tags not svg image tags. So I am not sure how this warning is being generated. And according to:
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image the list of attributes allowed does not even include an "xlink:title" attribute on that tag to match the xlink:href attribute. Also according to one of the bug reports, adding xlink:title="blah" to the svg image tag does not prevent epubcheck from generating that warning. In fact, one of the bug reports states:

I have the same error message in one of my epub. 
I have two inline svg, no links inside, no links in the whole xhtml file.
I've tried every possible variations, with "title", "xlink:title", tried to put them inside/outside/between the svg tag, the path tag, etc., no luck... Always the same warning.
It's just a warning but still... It's irritating :-)

It almost appears that epubcheck does not recognize the xlink:title tag when it is placed in the svg image or svg main tag. The svg snippet above is typically how epub ebooks add cover images so it is found in many many places. epub2 epubcheck does not indicate any problem with it, only epub3. In fact in one book a user found over 200 of these warnings.

So is this a bug in epubcheck 4.0.1? Should there be a "warning" generated for svg image tags? If so, why doesn't adding an xlink:title attribute to the svg image tag prevent the warning? How should the author address this warning?

@kevinhendricks
Copy link
Author

After further, examination, one report of this issue seems to be caused by an xhtml anchor "a" tag with href attributes that link directly to an svg image tag deep inside of an svg section of code and not to the xhtml div tag that wrapped the svg tag. I assume this meets the conditions of the xhtml anchor being viewed as an svg anchor to epubcheck (since it linked to the image element inside of the svg tag). The warning is just very confusing in this case as the xhtml anchor really does not need and xlink:title. Having never seen an xhtnl link to an id set deep inside of and svg element on an svg image tag, I am not sure how this should be viewed or checked. Not even sure there is a bug, now.

@rdeltour
Copy link
Member

rdeltour commented Mar 7, 2016

Thanks for the detailed bug report 👍. I'll have a look when prepping the next release.

@rdeltour rdeltour self-assigned this Mar 7, 2016
@rdeltour rdeltour added this to the Next milestone Mar 7, 2016
@rdeltour rdeltour added the type: bug The issue describes a bug label Mar 7, 2016
@kevinhendricks
Copy link
Author

Unless I am all wet here (and I could be since this is jst by glancing at the code) it appears that in src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java
the endElement() for svg never turns off inSVG, so this ACC_011 warning is incorrectly triggered by any xhtml anchor following an inline svg section in an xhtml document.
Hope this helps.

@ghost
Copy link

ghost commented Mar 12, 2016

Bug example :

HTML structure :

<body>

    <svg>
        ...
    </svg>


    <a ...>
    <a ...>
    <a ...>

</body>

=> epubcheck 4.0.1 reports 3 warnings

<body>

    <a ...>
    <a ...>
    <a ...>  

    <svg>
        ...
    </svg>

</body>

=> No warning.

@vigneshkumarelumalai
Copy link

I'm also facing the same issue. can we ignore the warning for time being.

@pcgorman
Copy link

Same issue here. xhtml links, outside of and linking to external sites result in the warning.

@tofi86 tofi86 added the status: has PR The issue is being processed in a pull request label Jun 5, 2017
@rdeltour
Copy link
Member

Fixed with #750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Projects
None yet
Development

No branches or pull requests

5 participants