CSS' user-select and accessibility

大憨熊 提交于 2021-02-06 10:12:34

问题


If I use the following:

-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

I can disable text selection of certain elements on my web page. Works well for buttons and links which don't give as nice a UX if selected (obviously opinion).

Am I free to use this wherever I feel necessary? Or are there accessibility implications? i.e. do screen readers and other tools rely on text selection?

Note: I'm not asking for opinion on the usage of user-select attributes, I'm looking for facts on levels of accessibility being affected by it.


回答1:


Screen readers and other tools rely on the base HTML document that you send along. As such, making things unselectable should not have an effect, just as other styling effects wouldn't matter.

JAWS and other screen readers work by skimming HTML documents and creating something like a DOM model for the user to move through. Using them on the internet requires that one know a bit about headings and paragraph tags, so a user will already understand the way websites are supposed to be written. Often, a sightless user will skim through the headings, much like how a sighted person would skim through a Wikipedia article, stopping when they find the section they want, and ordering the screen reader to read the next paragraph below. For this reason, it's important to lay out your HTML correctly, so that a screen reader can read it top to bottom.

for more information, and for building your website with inclusion in mind, I would read the following links on how to provide for the differently abled

http://www.w3.org/WAI/intro/people-use-web/stories

http://www.w3.org/WAI/guid-tech.html , Especially "How to Meet WCAG 2.0"

http://www.paciellogroup.com/blog/2008/03/how-jaws-reads-text/

As for other accesibility implications, I know plenty of people who like to read websites by highlighting a roughtly sentence long section of the paragraph they are reading, then the next section, and so on. Making large text paragraphs unreadable (although I think you mentioned you wouldn't do this) would probably make some sort of issue with someone's workflow, but then again, what doesn't?




回答2:


(It might have several drawbacks for usability, but as you explicitly ask about accessibility, I’m ignoring these here.)

Two possible accessibility implications (and there are likely way more, as there are numerous disabilities, and even more aids, up to unique solutions):

  • Some people with an intellectual/learning disability might have problems understanding the meaning of certain words. By not allowing copy-paste, you force them to manually type the words if they want to look them up somewhere (which is just a usability problem), but not all people might be able to do so (where it becomes an accessibility problem).

  • It’s also conceivable that some people use a text-to-speech tool (not a screen reader) that reads the selected text on command, because they have problems to (or can’t) read.

(Using plain language might mitigate these.)



来源:https://stackoverflow.com/questions/31250554/css-user-select-and-accessibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!