daisy / ace

Ace by DAISY, an Accessibility Checker for EPUB
MIT License
75 stars 22 forks source link

role=heading missing from heading outline #308

Closed pkra closed 4 years ago

pkra commented 4 years ago

I'm using Ace v1.1.1 on node v12.10 (ubuntu 19.10).

Elements with role=heading (and, say, aria-level=1) do not seem to be included in the heading outline.

E.g.,

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">
<head>
<title>Ace role heading test</title>
</head>
<body>
<div role="heading" aria-level="1">An H1!</div>
<p>Hello</p>
</body>
</html>

leads to "Untitled BODY" in the outlines.

rdeltour commented 4 years ago

Elements with role=heading (and, say, aria-level=1) do not seem to be included in the heading outline.

Good catch, thanks for the report!

pkra commented 4 years ago

Thanks @rdeltour. Looks like

https://github.com/daisy/ace/blob/896d1daa02a274b17add78c161337fe1e8199d6e/packages/ace-core/src/scripts/ace-extraction.js#L130

is too simple. I'm happy to try making a pull request.

rdeltour commented 4 years ago

Yes, I had a quick look at the code and came to the same conclusion. PR welcome of course!

laudrain commented 4 years ago

@pkra I understand the technical issue. But i'm wondering why not use a <h1> tag in the first place instead of a <div>?

pkra commented 4 years ago

@laudrain this was just a minimal example to exhibit the bug with minimal side effects.

Of course, the First Rule of ARIA applies but sometimes authors cannot use the native HTML element and sometimes there is no native element (e.g., there is no h7 and above).

laudrain commented 4 years ago

@pkra understood.