可访问性 - 可访问线路断路的标题?
情况:我必须在标题中迫使线路破裂。
The quick brown fox
jumps over the lazy dog
我可以做< h1> Quick Brown Fox< br/>跳过懒惰的狗</h1>
,但是屏幕阅读器将其解释为“标题1,2个项目”。屏幕阅读器是否有办法不阅读它?
我有这样的解决方案:
<h1 aria-hidden="true">The quick brown fox<br/> jumps over the lazy dog</h1>
<h1 class="sr-only">The quick brown fox jumps over the lazy dog</h1>
2个HTML元素,一个用于“为非视野障碍的用户进行线路休息”,另一个用于“不为非视觉损害的用户进行线路休息”。这里有更好的方法吗?
Situation: I have to force line-breaks in a heading.
The quick brown fox
jumps over the lazy dog
I can do <h1>The quick brown fox<br/> jumps over the lazy dog</h1>
, but a screen-reader will interpret it as "heading level 1, 2 items". Is there a way for the screen reader to not read it?
I have this solution:
<h1 aria-hidden="true">The quick brown fox<br/> jumps over the lazy dog</h1>
<h1 class="sr-only">The quick brown fox jumps over the lazy dog</h1>
2 HTML elements, one for "doing a line break for non-visually impaired users", and one for "not doing a line break for non-visually impaired users". Is there a better approach here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜有两个选择
将保留空白。这是一个缺点,即它不适合其与字体大小的容器的宽度,从而使可访问性更具降级。如果您确定您的文本会通过 wcag的成功标准。 /a>,这可能是一种选择。
至少在NVDA中起作用的更灵活的解决方案是添加一个pseudo块元素宽度高度0 。
There are two options I guess
will preserve the white space as-is. This has the disadvantage that it’s not adjusting to it’s container’s width in relation to the font-size any more, degrading accessibility. If you’re sure your text will pass WCAG’s Success Criterion 1.4.10: Reflow, that might be an option.
The more flexible solution, that works in NVDA at least, is to add a pseudo block element width height 0.