简体   繁体   English

如何:指导屏幕阅读器从代码中读出什么

[英]How to: Instruct a screen reader what to read out in code

I am unsure on how to make the screenreader read out a specific message for an email input instead of just reading 'email was selected'. 我不确定如何使屏幕阅读器读出用于电子邮件输入的特定消息,而不仅仅是读取“已选择电子邮件”。

Right now when tabbing to the 'from' box, it says 'Test@gmail.com selected' when I enter Test@gmail.com into the input. 现在,当跳到“来自”框时,当我在输入中输入Test@gmail.com时,它会显示“ Test@gmail.com selected”。 I want it to say "Your email address is (read text); you may enter a different email if you would like." 我希望它说“您的电子邮件地址是(阅读文字);您可以输入其他电子邮件。” I am unsure of how to approach this without entering more elements on the page that say that text exactly. 我不确定如何在不输入页面上准确地说出该文本的其他元素的情况下进行处理。

<input role="textbox"
    tabindex="0"
    id="from-input"
    name="from-input"
    class="liberty-input col-12 disabled"
    formControlName="from"
    [readOnly]="true" />

you can use title attribute. 您可以使用标题属性。 Just hover over input box and type something. 只需将鼠标悬停在输入框上并输入内容即可。

 $('#myid').keyup(function(){ if($('#myid').val() !== ''){ $("img").attr("width", "500"); $('#myid').attr('title', 'your email is :'+ $('#myid').val()) } }) 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input id="myid" value="" title="Your mail address">Visit our HTML Tutorial</a> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 JavaScript 确定屏幕阅读器会读取什么内容? - How can I determine with JavaScript what a screen reader would read? 如果用户尝试提交无效信息,如何让屏幕阅读器读出出现的验证错误文本? - How to make screen reader read out a validation error text that appears if the user tries to submit invalid information? 如何让屏幕阅读器读出混合的文本和组件? - How can I make a screen reader read out a mix of text and components? 如何通过屏幕阅读器读取输入然后标签? - How to read input then label via screen reader? 如何 NVDA 屏幕阅读器阅读工具提示? - how to NVDA screen reader read the tool-tip? 如何使屏幕阅读器读取“ x个项目的列表”列表 - How to make the screen reader read a list as “list of x number of items” 如何让屏幕阅读器停止阅读和阅读不同的内容 - How to get a screen reader to stop reading and read different content 如何确定屏幕阅读器阅读文本的顺序? - How can I determine the order in which text is read by a screen reader? 屏幕阅读器无法读取 Firefox 中的 Aria-Live - Aria-Live in Firefox not read by screen reader 将句子“-”替换为使用屏幕阅读器阅读“破折号”以获得可访问性 - Replace sentence "-" to read "dash" with screen reader for accessibility
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM