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

role=heading missing from heading outline #308

Closed
pkra opened this issue Mar 3, 2020 · 6 comments · Fixed by #309
Closed

role=heading missing from heading outline #308

pkra opened this issue Mar 3, 2020 · 6 comments · Fixed by #309
Assignees
Labels

Comments

@pkra
Copy link
Contributor

pkra commented Mar 3, 2020

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
Copy link
Member

rdeltour commented Mar 3, 2020

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!

@rdeltour rdeltour self-assigned this Mar 3, 2020
@rdeltour rdeltour added the bug label Mar 3, 2020
@pkra
Copy link
Contributor Author

pkra commented Mar 3, 2020

Thanks @rdeltour. Looks like

let hxElems = document.querySelectorAll('h1, h2, h3, h4, h5, h6');

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

@rdeltour
Copy link
Member

rdeltour commented Mar 3, 2020

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

@laudrain
Copy link

laudrain commented Mar 3, 2020

@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
Copy link
Contributor Author

pkra commented Mar 3, 2020

@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
Copy link

laudrain commented Mar 3, 2020

@pkra understood.

pkra added a commit to pkra/ace that referenced this issue Mar 3, 2020
Enables ace-extraction's getHeadings() to detect headings marked
via role=heading; uses aria-level or the spec fallback.

Fixes daisy#308
pkra added a commit to pkra/ace that referenced this issue Mar 3, 2020
Enables ace-extraction's getHeadings() to detect headings marked
via role=heading; uses aria-level or the spec fallback.

Fixes daisy#308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants