{"id":312379,"date":"2020-11-01T15:00:14","date_gmt":"2020-11-01T15:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=312379"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=312379","title":{"rendered":"\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0434\u043b\u044f \u043b\u044e\u0434\u0435\u0439 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><b>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/b><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <b>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435<\/b> \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <a href=\"https:\/\/www.w3.org\/TR\/wai-aria\/#aria-modal\">\u00abaria-modal\u00bb<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438!<\/h3>\n<p>   \u00abaria-modal\u00bb \u2014 \u044d\u0442\u043e \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c (\u0442\u0430\u043a\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0447\u0442\u0435\u043d\u0438\u044f \u0441 \u044d\u043a\u0440\u0430\u043d\u0430), \u0447\u0442\u043e \u0432\u0435\u0431-\u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043f\u043e\u0434 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u043c \u043e\u043a\u043d\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u0438\u043d\u0435\u0440\u0442\u0435\u043d). \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0438 \u043e\u0434\u0438\u043d \u0435\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043a\u043d\u043e\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u043e\u043a\u0443\u0441 \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435, \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u00abTAB\/SHIFT+TAB\u00bb \u0438\u043b\u0438 \u043f\u0440\u0438 \u0441\u0432\u0430\u0439\u043f\u0435 \u043d\u0430 \u0441\u0435\u043d\u0441\u0435\u0440\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445. <\/p>\n<p>   \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u00abaria-modal\u00bb \u0434\u043b\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430? <\/p>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0447\u0438\u043d:<\/p>\n<ul>\n<li> \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0441 \u044d\u043a\u0440\u0430\u043d\u0430<\/li>\n<li> \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0441\u0435\u0432\u0434\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 &quot;:before\/:after&quot;<\/li>\n<\/ul>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>   \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c <b>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435 <\/b>\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e:<\/p>\n<ul>\n<li> \u0432\u0441\u0435 \u0438\u043d\u0442\u0440\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0432\u043d\u0435 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c: \u043a\u043b\u0438\u043a\u0430, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043e\u043a\u0443\u0441\u0430 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435&#8230;<\/li>\n<li> \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u0438 \u043f\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0430\u043d\u0430 (\u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432\u043d\u0435 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d)<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0417\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430.<\/p>\n<p>  HTML:<\/p>\n<pre><code class=\"xml\">&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt;     &lt;meta charset=&quot;UTF-8&quot;&gt;     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;     &lt;title&gt;Document&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;     &lt;div&gt;         &lt;button type=&quot;button&quot; id=&quot;infoBtn&quot; class=&quot;btn&quot;&gt; Standart button &lt;\/button&gt;         &lt;button type=&quot;button&quot; id=&quot;openBtn&quot;&gt; Open modal window&lt;\/button&gt;         &lt;div role=&quot;button&quot; tabindex=&quot;0&quot; id=&quot;infoBtn&quot; class=&quot;btn&quot;&gt; Custom button &lt;\/button&gt;     &lt;\/div&gt;     &lt;div&gt;         Lorem, ipsum dolor sit amet consectetur adipisicing elit. Deserunt maxime tenetur sint porro tempore aperiam! Eaque tempore repudiandae culpa omnis placeat, fugit nostrum quisquam in ipsa odit accusamus illum velit?     &lt;\/div&gt;       &lt;div id=&quot;modalWindow&quot; class=&quot;modal&quot;&gt;         &lt;div&gt;             &lt;button type=&quot;button&quot; id=&quot;closeBtn&quot; class=&quot;btn-close&quot;&gt;Close&lt;\/button&gt;             &lt;h2&gt;Modal window&lt;\/h2&gt;             &lt;p&gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita, doloribus.&lt;\/p&gt;         &lt;\/div&gt;     &lt;\/div&gt; &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  \u0421\u0442\u0438\u043b\u0438:<\/p>\n<pre><code class=\"css\">    .modal {         position: fixed;         font-family: Arial, Helvetica, sans-serif;         top: 0;         right: 0;         bottom: 0;         left: 0;         background: rgba(0,0,0,0.8);         z-index: 99999;         transition: opacity 400ms ease-in;         display: none;         pointer-events: none;     }          .active{         display: block;         pointer-events: auto;     }      .modal &gt; div {         width: 400px;         position: relative;         margin: 10% auto;         padding: 5px 20px 13px 20px;         border-radius: 10px;         background: #fff;     }      .btn-close {         padding: 5px;         position: absolute;         right: 10px;         border: none;         background: red;         color: #fff;         box-shadow: 0 0 10px rgba(0,0,0,0.5);     }      .btn {         display: inline-block;         border: 1px solid #222;         padding: 3px 10px;         background: #ddd;         box-sizing: border-box;     } <\/code><\/pre>\n<p>  JS:<\/p>\n<pre><code class=\"javascript\">    let modaWindow = document.getElementById('modalWindow');      document.getElementById('openBtn').addEventListener('click', function() {         modaWindow.classList.add('active');     });      document.getElementById('closeBtn').addEventListener('click', function() {         modaWindow.classList.remove('active');     }); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0437\u0430 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043a\u043d\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u00abTAB\/SHIFT+TAB\u00bb, \u0442\u043e \u044d\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0444\u043e\u043a\u0443\u0441, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/83\/yp\/le\/83yple1rmzs5-wzbt93nia_jllw.png\" alt=\"image\"\/><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0432\u0441\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 &#8216;tabindex&#8217; \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0438\u043d\u0443\u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u0430. <\/p>\n<p>  1. \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u00abmodalWindow\u00bb c\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438:<\/p>\n<ul>\n<li>doc \u2014 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0440\u043e\u0438\u043c \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e <\/li>\n<li>modal \u2014 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 <\/li>\n<li>interactiveElementsList \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <\/li>\n<li>blockElementsList- \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u043b\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <\/li>\n<li>constructor \u2014 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <\/li>\n<li>create \u2014 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 <\/li>\n<li>remove \u2014 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 <\/li>\n<\/ul>\n<p>  2. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:<\/p>\n<pre><code class=\"javascript\">constructor(doc, modal) {     this.doc = doc;     this.modal = modal;     this.interactiveElementsList = [];     this.blockElementsList = []; } <\/code><\/pre>\n<p>  \u00abinteractiveElementsList\u00bb \u0438 \u00abblockElementsList \u00bb \u043d\u0443\u0436\u043d\u044b \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430.<\/p>\n<p>  3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0444\u043e\u043a\u0443\u0441:<\/p>\n<pre><code class=\"javascript\">const INTERECTIVE_SELECTORS = ['a', 'button', 'input', 'textarea', '[tabindex]']; <\/code><\/pre>\n<p>  4. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 &#8216;create&#8217; \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e \u043d\u0430\u0448\u0438\u043c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430\u043c \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435\u043c &#8216;tabindex=-1&#8217; (\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435)<\/p>\n<pre><code class=\"javascript\"> let elements = this.doc.querySelectorAll(INTERECTIVE_SELECTORS.toString());  let element;  for (let i = 0; i &lt; elements.length; i++) {      element = elements[i];      if (!this.modal.contains(element)) {          if (element.getAttribute('tabindex') !== '-1') {                element.setAttribute('tabindex', '-1');                this.interactiveElementsList.push(element);          }      }  } <\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438 \u0438\u043b\u0438 \u0436\u0435\u0441\u0442\u044b(\u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445) \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0432\u0438\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u043d\u043e \u0438 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <\/p>\n<p>  5. \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432\u0441\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u0437\u043b\u0430 &#8216;body&#8217; <\/p>\n<pre><code class=\"javascript\">let children = this.doc.body.children; <\/code><\/pre>\n<p>  6. \u0427\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u0448\u0430\u0433 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d \u0448\u0430\u0433\u0443 2, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c &#8216;aria-hidden&#8217;<\/p>\n<pre><code class=\"javascript\">for (let i = 0; i &lt; children.length; i++) {    element = children[i];    if (!this.modal.contains(element)) {       if (element.getAttribute('aria-hidden') !== 'true') {           element.setAttribute('aria-hidden', 'true');           this.blockElementsList.push(element);        }     } } <\/code><\/pre>\n<p>  \u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u00abcreate\u00bb:<\/p>\n<pre><code class=\"javascript\">create() {     let elements = this.doc.querySelectorAll(INTERECTIVE_SELECTORS.toString());     let element;     for (let i = 0; i &lt; elements.length; i++) {         element = elements[i];         if (!this.modal.contains(element)) {             if (element.getAttribute('tabindex') !== '-1') {                 element.setAttribute('tabindex', '-1');                 this.interactiveElementsList.push(element);             }         }     }      let children = this.doc.body.children;     for (let i = 0; i &lt; children.length; i++) {         element = children[i];         if (!this.modal.contains(element)) {             if (element.getAttribute('aria-hidden') !== 'true') {                 element.setAttribute('aria-hidden', 'true');                 this.blockElementsList.push(element);             }         }     } } <\/code><\/pre>\n<p>  7. \u041d\u0430 \u0448\u0435\u0441\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 &#8216;create&#8217;:<\/p>\n<pre><code class=\"javascript\"> remove() {             let element;             while(this.interactiveElementsList.length !== 0) {                 element = this.interactiveElementsList.pop();                 element.setAttribute('tabindex', '0');             }              while(this.interactiveElementsList.length !== 0) {                 element = this.interactiveElementsList.pop();                 element.setAttribute('aria-gidden', 'false');             } } <\/code><\/pre>\n<p>  8. \u0427\u0442\u043e \u0431\u044b \u044d\u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u00abmodalWindow\u00bb \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u00abcreate\u00bb \u0438 \u00abremove\u00bb:<\/p>\n<pre><code class=\"javascript\">    let modaWindow = document.getElementById('modalWindow');     const modal = new modalWindow(document, modaWindow);      document.getElementById('openBtn').addEventListener('click', function() {         modaWindow.classList.add('active');        \/\/ modal.create();     });      document.getElementById('closeBtn').addEventListener('click', function() {         modaWindow.classList.remove('active');        \/\/ modal.remove();     }); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"javascript\">class modalWindow{     constructor(doc, modal) {         this.doc = doc;         this.modal = modal;         this.interactiveElementsList = [];         this.blockElementsList = [];     }      create() {         let elements = this.doc.querySelectorAll(INTERECTIVE_SELECTORS.toString());         let element;         for (let i = 0; i &lt; elements.length; i++) {             element = elements[i];             if (!this.modal.contains(element)) {                 if (element.getAttribute('tabindex') !== '-1') {                     element.setAttribute('tabindex', '-1');                     this.interactiveElementsList.push(element);                 }             }         }          let children = this.doc.body.children;         for (let i = 0; i &lt; children.length; i++) {             element = children[i];             if (!this.modal.contains(element)) {                 if (element.getAttribute('aria-hidden') !== 'true') {                     element.setAttribute('aria-hidden', 'true');                     this.blockElementsList.push(element);                 }             }         }     }      remove() {         let element;         while(this.interactiveElementsList.length !== 0) {             element = this.interactiveElementsList.pop();             element.setAttribute('tabindex', '0');         }          while(this.interactiveElementsList.length !== 0) {             element = this.interactiveElementsList.pop();             element.setAttribute('aria-gidden', 'false');         }     } <\/code><\/pre>\n<p>  <\/p>\n<h2>P.S. <\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443:<\/p>\n<pre><code class=\"javascript\">  const BLOCKS_SELECTORS = ['div', 'header', 'main', 'section', 'footer'];   let children = this.doc.querySelectorAll(BLOCKS_SELECTORS .toString()); <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/h3>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.w3.org\/TR\/wai-aria\/\">www.w3.org\/TR\/wai-aria<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/TR\/WCAG21\/\">www.w3.org\/TR\/WCAG21<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/HTML\/Global_attributes\/tabindex\">developer.mozilla.org\/ru\/docs\/Web\/HTML\/Global_attributes\/tabindex<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/526016\/\"> https:\/\/habr.com\/ru\/post\/526016\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><b>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/b><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <b>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435<\/b> \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e, \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <a href=\"https:\/\/www.w3.org\/TR\/wai-aria\/#aria-modal\">\u00abaria-modal\u00bb<\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-312379","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312379"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312379\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}