FocusCase.js — react Source File
Architecture documentation for FocusCase.js, a javascript file in the react codebase. 5 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR da713056_fba4_f906_d9d7_9204b2c965ef["FocusCase.js"] 14dde3c9_48ef_6e34_3667_978d06aff15d["TestCase.js"] da713056_fba4_f906_d9d7_9204b2c965ef --> 14dde3c9_48ef_6e34_3667_978d06aff15d e1e356f5_b085_dad5_a81f_4b4844381311["TestCase"] da713056_fba4_f906_d9d7_9204b2c965ef --> e1e356f5_b085_dad5_a81f_4b4844381311 bc8ae172_cc20_3692_943c_bbdb1ad34855["Fixture.js"] da713056_fba4_f906_d9d7_9204b2c965ef --> bc8ae172_cc20_3692_943c_bbdb1ad34855 2851624d_a736_f3f6_2132_5a20630983fe["Fixture"] da713056_fba4_f906_d9d7_9204b2c965ef --> 2851624d_a736_f3f6_2132_5a20630983fe a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb["Fixture"] da713056_fba4_f906_d9d7_9204b2c965ef --> a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb 463c662d_adfd_912e_a87b_b390bc35e100["index.js"] 463c662d_adfd_912e_a87b_b390bc35e100 --> da713056_fba4_f906_d9d7_9204b2c965ef style da713056_fba4_f906_d9d7_9204b2c965ef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import TestCase from '../../TestCase';
import Fixture from '../../Fixture';
const React = window.React;
const {Fragment, useRef} = React;
export default function FocusCase() {
const fragmentRef = useRef(null);
return (
<TestCase title="Focus Management">
<TestCase.Steps>
<li>Click to focus the first child</li>
<li>Click to focus the last child</li>
<li>Click to blur any focus within the fragment</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
<p>
The focus method will focus the first focusable child within the
fragment, skipping any unfocusable children.
</p>
<p>
The focusLast method is the reverse, focusing the last focusable
child.
</p>
<p>
Blur will call blur on the document, only if one of the children
within the fragment is the active element.
</p>
</TestCase.ExpectedResult>
<Fixture>
<Fixture.Controls>
<button onClick={() => fragmentRef.current.focus()}>
Focus first child
</button>
<button onClick={() => fragmentRef.current.focusLast()}>
Focus last child
</button>
<button onClick={() => fragmentRef.current.blur()}>Blur</button>
</Fixture.Controls>
<div className="highlight-focused-children" style={{display: 'flex'}}>
<Fragment ref={fragmentRef}>
<div style={{outline: '1px solid black'}}>
<p>Unfocusable div</p>
</div>
<div style={{outline: '1px solid black'}}>
<p>Unfocusable div with nested focusable button</p>
<button>Button 1</button>
</div>
<button>Button 2</button>
<input type="text" placeholder="Input field" />
<div style={{outline: '1px solid black'}}>
<p>Unfocusable div</p>
</div>
</Fragment>
</div>
</Fixture>
</TestCase>
);
}
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does FocusCase.js do?
FocusCase.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in FocusCase.js?
FocusCase.js defines 1 function(s): FocusCase.
What does FocusCase.js depend on?
FocusCase.js imports 5 module(s): Fixture, Fixture, Fixture.js, TestCase, TestCase.js.
What files import FocusCase.js?
FocusCase.js is imported by 1 file(s): index.js.
Where is FocusCase.js in the architecture?
FocusCase.js is located at fixtures/dom/src/components/fixtures/fragment-refs/FocusCase.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components/fixtures/fragment-refs).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free