惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
K
Kaspersky official blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
小众软件
小众软件
云风的 BLOG
云风的 BLOG
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
量子位
S
Secure Thoughts
G
GRAHAM CLULEY
C
CXSECURITY Database RSS Feed - CXSecurity.com
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
T
Threat Research - Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 聂微东
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
S
Security Affairs
Help Net Security
Help Net Security
博客园 - 三生石上(FineUI控件)
AWS News Blog
AWS News Blog
博客园 - 叶小钗
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
H
Heimdal Security Blog
W
WeLiveSecurity
C
Check Point Blog

MarcySutton.com RSS Feed

On Joining Khan Academy Developing anti-SLAPP policies for A11y Slack with Harvard Cyberlaw Clinic Focus on What Matters Celebrating One Year of Independence as Modern Sole Design, LLC Evinced is Pushing the Limits of Automated Accessibility Testing Content-visibility and Accessible Semantics Finding accessibility jobs in specialized companies and the mainstream Outsider Leverage and Accessibility Encouraging Open Source Contributions with Docs: a Self-Fulfilling Prophecy Remote Work and Van Life Salary and Career Growth Prototype Testing for Accessible Client-Side Routing On Great Leadership, Gatsby & Girl Develop It The Deal with Developer Advocacy Live Coding Accessibility Chapter Two at Deque 2017, in Music Writing winning abstracts Accessibility is a Civil Right 2016, a Year of Milestones Best of 2016 Music Links vs. Buttons in Modern Web Applications Accessibility and Performance I won an O Web Accessibility Resources This is what a developer looks like. What Wally On writing better captions for images What I’ve Learned Working on a Large Open-Source Framework Speak at your local elementary school. Button Focus Hell Page Scrolling in Mobile Safari & VoiceOver Accessibility Wins Notes from CSUN 2015 Protractor Accessibility Plugin Riding a bicycle to an accessibility conference 2014: One to Remember AngularJS Material Design & ngAria Summing Up JSConf EU 2014 How I Audit a Website for Accessibility Accessibility and the Shadow DOM: JSConf Australia 2014 CSUN 2014 Conference Recap Accessibility and the Shadow DOM Favorite Music 2013 Girl Develop It Web Accessibility Mobile Web Accessibility with VoiceOver Webstock & NZ 2013 Favorite Music 2012 Target Corporate Site Redesign: Accessible & Responsive Web Development Decibel Festival Recap 2012 Favorite Music 2011 Spiceboard: Wordpress Recipes for iPad POP Clock Favorite Music 2010 Christmas JS1k Zend Framework. NACCC Urban Type Sutton RV Simplexml in php 5 AS3 Load Workflow AS3 Mouse Events Holiday 2009 Why Outlook Sucks
CSS + JS + Accessibility
2010-12-29 · via MarcySutton.com RSS Feed

December 29, 2010

I have spent a lot of time retrofitting a certain website for screen readers recently. Before a month or two ago, I couldn’t have told you how to really hide text from screen readers (and I received conflicting reports on how to do it). Through the process of code, review and repeat, I nailed down some of the basics of CSS and Javascript for improved accessibility.

One of the keys to improving screen reader user experience: users shouldn’t be forced to listen to ALL of the content on the page when it is being hidden from sighted users (think Javascript accordion). Here’s how to really hide content from screen readers:

<style type="text/css">
.reallyHidden {
      display:none;
      visibility:hidden;
}
</style>

Not to be confused with offscreen positioning, which is still read aloud to screen readers. This method is used to provide context for background images (like graphic headlines and logos) and to hide access menus from sighted users:

<style type="text/css">
.offscreen {
      position:absolute;
      left:-50000px;
}
</style>

The other thing I’ve spent a lot of time on is making custom JavaScript widgets keyboard & screen reader accessible (tab switchers, accordions, etc.). Because these widgets present new content on interaction, we have to alert screen reader users to that new content and make it clear what’s going on.

There are three parts to this accessibility requirement:

  1. Updating links after triggering action to indicate what they will do: Expand vs. Minimize

  2. If links are kept short for visual reasons (i.e. Expand >), add offscreen text to provide context:

    <a href="#" id="trigger">
          <span class='tip'>Expand</span> 
          <span class="offscreen">content section</span>
    </a>
  3. If new content appears on screen, send focus there dynamically so screen reader users know it has been added. Be aware this takes focus away from the link, but this only really affects keyboard users.

    
    $('a#trigger').click(function(e){
         // span.tip needs logic for toggle, this only goes one way
         $(this).find('span.tip').text('Minimize');  
         $('#newContent').focus();
    });