通知用户会话即将过期的可访问方式
我有一个网站,它在给定的时间段内对用户进行身份验证,并在任何后续页面上请求延长时间间隔。我想知道如何在不使用 js.alert() 的情况下通知用户他们的时间即将到期,但又保持可访问性。
我见过一些网站,内容会从顶部滑入,不会打扰用户,但仍然引人注目。我看到的问题是它可能不会更新屏幕阅读器的缓冲区,并且具有辅助功能需求的用户不会意识到这一点。
建议?
I have a site which authenticates a user for a given time period and on any subsequent page request that time interval is extended. I am wondering how to notify users their time is about to expire without using a js.alert() but also remain accessible.
I have seen some sites where content will slide in from the top and not intrude the user but still be noticeable. The problem I see with this is that it may not update the screen reader's buffer and the users with accessibility needs will not become aware of this.
Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以可访问方式提醒用户的正确方法应该是符合 WAI-ARIA (可访问的富互联网应用)规范。现在,这些文档只是您实施的技术部分 - 与所有互联网技术一样,它在屏幕阅读器和其他辅助工具之间的实施差异很大,并且在没有广泛测试的情况下很难确定,但它肯定是我们所使用的最好的截至目前。
规范要求使用
role='alert'
标记此类消息,并使用role='alertdialog'
属性标记其对话框。它指出警报是这肯定符合要求。现在我不确定您是否担心屏幕阅读器缓冲区问题,但就我对这个主题的阅读来看,采用 WAI-ARIA 规范的屏幕阅读器将需要不断扫描页面以获取新的属性和元素,作为教程 这表明,甚至可以将
alert
属性添加到页面上已有的元素中,因此我认为您的担忧不会给现代屏幕阅读器带来问题。The correct method of alerting a user accessibly should be to conform to the WAI-ARIA (Accessible Rich Internet Application) Specifications. Now the documents are only the technical part of your implementation - as with all Internet technology its implementation among screen readers and other accessibility tools varies widely and is difficult to ascertain without extensive testing, but it is certainly the best we've got to work with as of now.
The specifications calls for this type of messages to be marked with the
role='alert'
, and their dialog boxes with therole='alertdialog'
attribute. It states that alerts arewhich would certainly fit the bill. Now I'm not sure about your concern about the screen reader buffer problem, but as far as my reading on this subject goes the screen readers that adopt the WAI-ARIA specifications will need to be constantly scanning the page for new attributes and elements, as tutorials like this show, it is even possible to add the
alert
attribute to elements already present on the page, thus I do not believe that your concern should present a problem to modern screen readers.您可以使用一些不错的 JS/jquery 倒计时并将其显示给页面上的某个位置的用户。最终显示美观的对话框,并警告会话即将过期,或者只要页面打开,就使用 AJAX 静默刷新会话。
我在银行账户页面看到一个从10分钟开始倒计时的计时器。它非常简单,并为我提供了有关在会议结束之前我需要多少时间填写表格的详细信息。
You can use some nice JS/jquery countdown and show it to user somewhere on page. Eventually display well looking dialog with alert that session is going to expire, or silently refresh session with AJAX as long as page is opened.
I saw a timer counting down from 10 minutes in the bank account page. It's quite simple, and gives me good information about how much time i have to fill a form before my session will be closed.