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

Function handleTab

src/Modal.js:219–244  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

217 }
218
219 handleTab(e) {
220 if (e.which !== 9) return;
221 if (this.modalIndex < Modal.openCount - 1) return; // last opened modal
222
223 const focusableChildren = this.getFocusableChildren();
224 const totalFocusable = focusableChildren.length;
225 if (totalFocusable === 0) return;
226 const currentFocus = this.getFocusedChild();
227
228 let focusedIndex = 0;
229
230 for (let i = 0; i < totalFocusable; i += 1) {
231 if (focusableChildren[i] === currentFocus) {
232 focusedIndex = i;
233 break;
234 }
235 }
236
237 if (e.shiftKey && focusedIndex === 0) {
238 e.preventDefault();
239 focusableChildren[totalFocusable - 1].focus();
240 } else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
241 e.preventDefault();
242 focusableChildren[0].focus();
243 }
244 }
245
246 handleBackdropMouseDown(e) {
247 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…