MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / handleTab

Function handleTab

src/Offcanvas.js:180–205  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

178 }
179
180 handleTab(e) {
181 if (e.which !== 9) return;
182 if (this.offcanvasIndex < Offcanvas.openCount - 1) return; // last opened offcanvas
183
184 const focusableChildren = this.getFocusableChildren();
185 const totalFocusable = focusableChildren.length;
186 if (totalFocusable === 0) return;
187 const currentFocus = this.getFocusedChild();
188
189 let focusedIndex = 0;
190
191 for (let i = 0; i < totalFocusable; i += 1) {
192 if (focusableChildren[i] === currentFocus) {
193 focusedIndex = i;
194 break;
195 }
196 }
197
198 if (e.shiftKey && focusedIndex === 0) {
199 e.preventDefault();
200 focusableChildren[totalFocusable - 1].focus();
201 } else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
202 e.preventDefault();
203 focusableChildren[0].focus();
204 }
205 }
206
207 handleBackdropMouseDown(e) {
208 this._mouseDownElement = e.target;

Callers

nothing calls this directly

Calls 1

focusMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…