[HTML5] How Visible vs. Hidden Elements Affect Keyboard/Screen Reader Users (ARIA)
There are many techniques for hiding content in user interfaces, and not all are created equal! Learn how different hiding techniques in HTML, CSS and ARIA impact keyboard and screen reader users in addition to visual display. As a bonus, we'll also take a look using a screen reader on a mobile device.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Visible vs. Hidden</title>
<meta name="viewport" content="initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/demo.css">
</head>
<body>
<!-- no space reserved, hidden from aria-->
<div style="display: none;">
<h1>Heading</h1>
<a href="#link1">Link 1</a>
</div>
<!-- no space reservced, hidden from aria-->
<div hidden>
<h1>Heading</h1>
<a href="#link2">Link 2</a>
</div>
<!-- reserve the space, not hidden from aria-->
<div style="opacity: 0;">
<h1>Heading</h1>
<a href="#link3">Link 3</a><!-- can add tabindex="-1" to hide from tab focus -->
</div>
<!-- reserve the space, link is not reachable, similar to display:none; -->
<div style="visibility: hidden;">
<h1>Heading</h1>
<a href="#link4">Link 4</a>
</div>
<!-- content is still be renderered to the screen, and link is also reachable -->
<div class="visuallyhidden">
<h1>Heading</h1>
<a href="#link5">Link 5</a>
</div>
<!-- render to screen and hidden from aria-->
<div aria-hidden="true">
<h1>Heading</h1>
<a href="#link6">Link 6</a>
</div>
</body>
</html>
[HTML5] How Visible vs. Hidden Elements Affect Keyboard/Screen Reader Users (ARIA)的更多相关文章
- 零元学Expression Blend 4 - Chapter 39 虾米?!同款?不同师傅!告诉你Visible、Hidden与Collapsed的差异!
原文:零元学Expression Blend 4 - Chapter 39 虾米?!同款?不同师傅!告诉你Visible.Hidden与Collapsed的差异! 由此可知 Hidden为隐藏项目,但 ...
- [Cypress] Interact with Hidden Elements in a Cypress Test
We often only show UI elements as a result of some user interaction. Cypress detects visibility and ...
- [HTML5] Using the tabindex attribute for keyboard accessibility
You can make any element keyboard interactive with the HTML tabindex attribute. But you might need a ...
- 解决HTML5布局,兼容IE问题
当我们使用h5的新标签,header,footer,aside,section,article...时,会遇到低版本IE不兼容问题,如下图: 解决方案:引入如下JS代码,即可 (这里我就直接放源码了, ...
- CSS:opacity:0,visibility:hidden,display:none的区别
CSS中opacity=0,visibility=hidden,display=none的时候,三者有什么区别呢?? 参考了stackoverflow的博客,才发现区别如下所示: Here is a ...
- HTML5 API 是什么
HTML5 API 是什么 一.总结 1.html5有很多好的api可以用:例如绘图的canvas,获取地理位置的,获取手机电池信息的等等,后面用的时候可以百度 2.html5 API是什么:html ...
- 触摸屏键盘插件Virtual Keyboard 该怎么用 Virtual Keyboard 入门指南
最近公司有个项目,这个项目的显示器是触摸屏, 所以在一些需要简单输入的input需要加一个触摸屏的软键盘, 我在github上找了很多开源项目,最后选择了Virtual Keyboard, 以下是我自 ...
- html5的video元素学习手札
为了监控移动端视频播放的情况,研究了一下 html5 <video> 标签的属性与事件触发,及其在各系统和各个浏览器的兼容情况 属性与事件 理解清楚属性和事件,才能更好的使用 video ...
- 拥抱HTML5 — Page Visibility(页面可见性) API介绍
H5 提供了很多简单实用的 API,Page Visibility API 就是其中之一. 不知道用户是不是在与页面交互,这是困扰广大 Web 开发人员的一个主要问题.如果 页面最小化了 或者 隐藏在 ...
随机推荐
- servlet 处理过程
刚才花了一个小时找 servlet 的一个错误.终于找出来了,也大概明确 tomcat server对请求的处理顺序.以下做简单总结: 浏览器发送请求,传给 tomcat 在此请求地址指向的文件中定义 ...
- java中与运算,或运算,异或运算,取反运算
//与运算 & 规则 :都为1时才为1 System.out.println( 7 & 9); /* * 7二进制 0111 ...
- hdoj--1258--Sum It Up(dfs)
Sum It Up Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- php百度翻译类
<?php // +---------------------------------------------------------------------- // | PHP MVC Fra ...
- Linux Shell Scripting Cookbook 读书笔记 5
sed,awk 1. sed (string editor) 使用-i可以将结果运用于原文件 sed 's/text1/text2/' file > newfile mv newfile fil ...
- office2016专业版激活码
office2016专业版激活密钥 Office 2016 Pro Plus Retail 版激活密钥:office2016专业版激活码 [Key]:3XJTG-YNBMY-TBH9M-CWB2Y-Y ...
- Springboot使用AOP实现统一处理Web请求日志
1.要使我们自定义的记录日志能够打印出来,我们需要先排除springboot默认的记录日志,添加如下的设置 2.新建 resources/log4j.properties 我的设置为: # LOG4J ...
- LeetCode Weekly Contest 19
1.504. Base 7 水题,直接写.但是我错了一次,忘了处理0的情况. 没有考虑边界条件.写完代码,一般需要自己想几个边界测试用例进行测试. class Solution { public: s ...
- 30秒就能理解的JavaScript优秀代码
数组 arrayMax 返回数组中的最大值. 将Math.max()与扩展运算符 (...) 结合使用以获取数组中的最大值. const arrayMax = arr => Math.max(. ...
- MAVEN学习笔记之Maven生命周期和插件简介(3)
MAVEN学习笔记之Maven生命周期和插件简介(3) clean compile site三套生命周期相互独立. clean pre-clean 执行清理前的工作 clean 清理上一次构建生成的所 ...