<small id='nr9YY'></small><noframes id='nr9YY'>

      <tfoot id='nr9YY'></tfoot>
      • <bdo id='nr9YY'></bdo><ul id='nr9YY'></ul>
    1. <i id='nr9YY'><tr id='nr9YY'><dt id='nr9YY'><q id='nr9YY'><span id='nr9YY'><b id='nr9YY'><form id='nr9YY'><ins id='nr9YY'></ins><ul id='nr9YY'></ul><sub id='nr9YY'></sub></form><legend id='nr9YY'></legend><bdo id='nr9YY'><pre id='nr9YY'><center id='nr9YY'></center></pre></bdo></b><th id='nr9YY'></th></span></q></dt></tr></i><div id='nr9YY'><tfoot id='nr9YY'></tfoot><dl id='nr9YY'><fieldset id='nr9YY'></fieldset></dl></div>
      <legend id='nr9YY'><style id='nr9YY'><dir id='nr9YY'><q id='nr9YY'></q></dir></style></legend>
    2. 如何在打开时仅在模式弹出窗口内限制 Tab 键按下?

      时间:2023-06-21
        <tbody id='YPqSK'></tbody>
      1. <i id='YPqSK'><tr id='YPqSK'><dt id='YPqSK'><q id='YPqSK'><span id='YPqSK'><b id='YPqSK'><form id='YPqSK'><ins id='YPqSK'></ins><ul id='YPqSK'></ul><sub id='YPqSK'></sub></form><legend id='YPqSK'></legend><bdo id='YPqSK'><pre id='YPqSK'><center id='YPqSK'></center></pre></bdo></b><th id='YPqSK'></th></span></q></dt></tr></i><div id='YPqSK'><tfoot id='YPqSK'></tfoot><dl id='YPqSK'><fieldset id='YPqSK'></fieldset></dl></div>

        <small id='YPqSK'></small><noframes id='YPqSK'>

            • <bdo id='YPqSK'></bdo><ul id='YPqSK'></ul>

                <tfoot id='YPqSK'></tfoot>

              1. <legend id='YPqSK'><style id='YPqSK'><dir id='YPqSK'><q id='YPqSK'></q></dir></style></legend>
                本文介绍了如何在打开时仅在模式弹出窗口内限制 Tab 键按下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我打开了一个模式弹出窗口.我有可访问性要求.所以添加了 ARIA 相关的标签.但是当我点击 tab 键时,持续关注到实际页面后面的页面.

                I have a modal popup opened. I have accessibility requirement. So added ARIA related labels. But when i click tab key continuously focus going to the page behind the actual page.

                在 html 文件中添加了 role="dialog"

                但是当模式打开时,我只希望焦点在模式弹出窗口中导航.

                But when modal opened i want only the focus navigate within the modal popup.

                从事 Angular4, HTML5 项目.如果我们在 HTML 文件中找到解决方案会更好.我的意思是没有添加任何 javascript/jQuery 相关的东西来防止这种情况发生

                推荐答案

                你问的是焦点陷阱,这个演示很好地展示了它:https://focus-trap.github.io/focus-trap/

                You are asking about focus trap, it's nicely demonstrated in this demo: https://focus-trap.github.io/focus-trap/

                添加 role="dialog" 不会自动在该元素内提供陷阱焦点.事实上,浏览器并没有原生焦点陷阱.

                Adding role="dialog" will not automatically provide trap the focus within that element. In fact, there's no native focus trap provided by browsers.

                您需要选择以下选项之一:

                You need to go with one of following options:

                • 自己实现焦点陷阱(关于此的好文章:https://hiddedevries.nl/en/blog/2017-01-29-using-javascript-to-trap-focus-in-an-element)李>
                • 使用焦点陷阱的第 3 方解决方案,例如https://github.com/davidtheclark/focus-trap
                • 使用模态窗口的第 3 方解决方案,例如https://github.com/sweetalert2/sweetalert2 完全兼容 WAI-ARIA 规范并提供为您准备的焦点陷阱
                • implement focus trap by yourself (good article on this: https://hiddedevries.nl/en/blog/2017-01-29-using-javascript-to-trap-focus-in-an-element)
                • use 3rd party solutions of focus trap, e.g. https://github.com/davidtheclark/focus-trap
                • use 3rd party solutions of modal windows, e.g. https://github.com/sweetalert2/sweetalert2 which is fully compatible with WAI-ARIA specifications and provide focus trap for you

                这篇关于如何在打开时仅在模式弹出窗口内限制 Tab 键按下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何使用 jquery 滚动到模式中的元素? 下一篇:在引导程序中动态调整模态对话框的大小

                相关文章

                <i id='RaKbV'><tr id='RaKbV'><dt id='RaKbV'><q id='RaKbV'><span id='RaKbV'><b id='RaKbV'><form id='RaKbV'><ins id='RaKbV'></ins><ul id='RaKbV'></ul><sub id='RaKbV'></sub></form><legend id='RaKbV'></legend><bdo id='RaKbV'><pre id='RaKbV'><center id='RaKbV'></center></pre></bdo></b><th id='RaKbV'></th></span></q></dt></tr></i><div id='RaKbV'><tfoot id='RaKbV'></tfoot><dl id='RaKbV'><fieldset id='RaKbV'></fieldset></dl></div>
                • <bdo id='RaKbV'></bdo><ul id='RaKbV'></ul>

                  <small id='RaKbV'></small><noframes id='RaKbV'>

                  1. <legend id='RaKbV'><style id='RaKbV'><dir id='RaKbV'><q id='RaKbV'></q></dir></style></legend>

                    <tfoot id='RaKbV'></tfoot>