[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 开发人员的一个主要问题.如果 页面最小化了 或者 隐藏在 ...
随机推荐
- [专辑] 也晒晒我的RBAC系统 ——行一山人的博客
也晒晒我的RBAC系统(一):概述 也晒晒我的RBAC系统(二):系统实现原理简介 也晒晒我的RBAC系统(三):后台管理程序源码及使用演示 也晒晒我的RBAC系统(四):框架源代码(超值奉献,请勿拍 ...
- Comparable与Comparator源码分析
package java.lang; import java.util.*; /** * This interface imposes a total ordering on the objects ...
- 给统计人讲Python(1)_科学计算库-Numpy
本地代码是.ipynb格式的转换到博客上很麻烦,这里展示部分代码,了解更多可以查看我的git-hub:https://github.com/Yangami/Python-for-Statisticia ...
- MAVEN 杂记
MAVEN中央仓库 http://repo.maven.apache.org/maven2http://repo1.maven.org/maven2/http://mvnrepository.com/ ...
- B - Nearly Lucky Number
Problem description Petya loves lucky numbers. We all know that lucky numbers are the positive integ ...
- Android 低功耗蓝牙的多设备连接与数据接收,简单实现
在网络层,互联网提供所有应用程序都要使用的两种类型的服务,尽管目前理解这些服务的细节并不重要,但在所有TCP/IP概述中,都不能忽略他们: 无连接分组交付服务(Connectionless Packe ...
- Several Ideas on Perl List Context
According to Beginning Perl Book published by Tsinghua Pub., the list context appears when you are t ...
- 关于Linux操作系统层次结构分析
本文转自http://www.jb51.net/LINUXjishu/214104.html 首先来看一张图(这是Linux操作系统的大致层次结构): 最内层是硬件,最外层是用户常用的应用,比如说fi ...
- apiCloud中aui获取不到高度,pos.h为0,offsetHeight为0问题
apiCloud中aui获取不到高度,pos.h为0,offsetHeight为0问题 原HTML <div class="row aui-text-center"> ...
- Bootstrap 有一个 class 属性叫做 well,它的作用是为设定的列创造出一种视觉上的深度感
Bootstrap 有一个 class 属性叫做 well,它的作用是为设定的列创造出一种视觉上的深度感