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

<ol>が子を持たない場合に、誤ったエラーが出力される #1122

Open
momdo opened this issue Aug 26, 2023 · 4 comments
Open

Comments

@momdo
Copy link

momdo commented Aug 26, 2023

  • Markuplint version: 3.12.10
  • Parser lang: HTML
  • Node.js version: 20.5.1
  • OS: Windows

Describe the bug

<li>要素が0個の場合の<ol>(または<ul>)要素で下記のメッセージが出力されます

ロール「listitem」が必要です. Or, aria-busy="true"が必要です

しかし、ARIA in HTMLによれば<ol>要素にはlistitemは許可されていません。
https://www.w3.org/TR/html-aria/#el-ol

また、HTML仕様によれば、これはContent modelを満たしています。
https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element

Code Example

<ol></ol>
<ul></ul>

Steps To Reproduce

  1. 0個の<ol>(または<ul>)要素を記述します

The current behavior

ロール「listitem」が必要です. Or, aria-busy="true"が必要です

と出力されます。

The expected behavior

何も出力されません。

@momdo momdo added the Bug label Aug 26, 2023
@YusukeHirao
Copy link
Member

YusukeHirao commented Aug 30, 2023

@momdo

ご指摘ありがとうございます!

これ警告メッセージが悪かったですね。

❌ ロール「listitem」が必要です. Or, aria-busy="true"が必要です
✅ 子にロール「listitem」が必要です. もしくは<ol>にaria-busy="true"が必要です

という意図でした。

この警告は次の仕様により判定しています。

https://www.w3.org/TR/wai-aria-1.2/#mustContain

Any element that will be owned by the element with this role. For example, an element with the role list will own at least one element with the role listitem.

"least one element"なので、0個は許容しないという解釈です(もちろんHTML LSではOKなのは理解した上で)。

そして、

There may be times that required owned elements are missing, for example, while editing or while loading a data set. When a widget is missing required owned elements due to script execution or loading, authors MUST mark a containing element with aria-busy equal to true. For example, until a page is fully initialized and complete, an author could mark the document element as busy.

とあるので、「0個 = 生成待ち」なら「aria-busy」付けてね、という警告にしています。

ご意見ください…!

@momdo
Copy link
Author

momdo commented Aug 30, 2023

@YusukeHirao

コメントありがとうございます。
そんな記述があったんですね。勉強になります。

いただいたリンクのセクションの最後のNOTEには、

An element with the appropriate implicit WAI-ARIA semantic fulfills this requirement.

とあります。これは、たとえば<div role=list>であればそういう警告になるのでしょうが、
<ol>なり<ul>に当てはまらないのではないでしょうか?(<li>が見当たらないことに対して、warningを出すというのはありかもしれませんが)

@YusukeHirao
Copy link
Member

An element with the appropriate implicit WAI-ARIA semantic fulfills this requirement.

Oops! それは見逃してた…!

1.3ではこのへん、大幅に変わっててaria-busyも特定のロールにしか言及されてないっぽいので、全体的に1.2のこれも含めてもうちょっと仕様見直してみます。

よいきっかけになりました。ありがとうございます!

@YusukeHirao
Copy link
Member

@momdo

このIssue取り掛かろうと思っているので、再度仕様を読んでいるのですが

An element with the appropriate implicit WAI-ARIA semantic fulfills this requirement.

「暗黙的なARIAセマンティックをもつ要素」がこの要件を満たす、ということは逆に <ul> であっても明示的な role=list の要素と同様に要件が適用されるということなのでは?と思い始めました。

つまり、<ul>にとっても「will own at least one element with the role listitem.」ってことになるんじゃないでしょうか?

YusukeHirao added a commit that referenced this issue Jan 3, 2024
Fix the warning message and translation on `wai-aria` rule
@YusukeHirao YusukeHirao self-assigned this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants