@@ -681,6 +681,8 @@ function App() {
681681
682682 < label htmlFor = "tel" > Phone Number</ label >
683683 < input id = "tel" type = "tel" />
684+
685+ < button type = "submit" > Submit</ button >
684686 </ form >
685687
686688 < div >
@@ -1127,22 +1129,24 @@ function App() {
11271129 < div >
11281130 < button > Button before the trap</ button >
11291131
1130- < div
1132+ < details
11311133 className = { styles . keyboardTrap }
1132- tabIndex = { 0 }
11331134 onKeyDown = { event => {
11341135 // Prevent users from tabbing out of this container
11351136 if ( event . key === 'Tab' ) {
11361137 event . preventDefault ( ) ;
11371138 }
1138- } } >
1139- < h4 > Keyboard Trap</ h4 >
1139+ } }
1140+ open >
1141+ < summary >
1142+ < h4 > Keyboard Trap</ h4 >
1143+ </ summary >
11401144 < p >
11411145 This container traps keyboard focus by blocking the < kbd > Tab</ kbd > { ' ' }
11421146 key.
11431147 </ p >
11441148 < button > Keyboard focus is trapped after clicking me</ button >
1145- </ div >
1149+ </ details >
11461150
11471151 < button >
11481152 Button after the trap < wbr />
@@ -1472,7 +1476,7 @@ function App() {
14721476 </ header >
14731477
14741478 < div className = { styles . multipleWays } >
1475- < nav role = "tablist" >
1479+ < div role = "tablist" >
14761480 { MULTIPLE_WAYS_TABS . map ( ( tab , index ) => (
14771481 < button
14781482 key = { tab }
@@ -1488,7 +1492,7 @@ function App() {
14881492 { tab }
14891493 </ button >
14901494 ) ) }
1491- </ nav >
1495+ </ div >
14921496
14931497 < div role = "tabpanel" tabIndex = { 0 } aria-labelledby = { activeTab } >
14941498 < h3 > { activeTab } </ h3 >
@@ -1973,7 +1977,7 @@ function App() {
19731977 < form
19741978 onSubmit = { event => {
19751979 event . preventDefault ( ) ;
1976- alert ( 'Form auto-! !' ) ;
1980+ alert ( 'Form auto-submitted !' ) ;
19771981 } } >
19781982 < label >
19791983 < input
@@ -1993,8 +1997,8 @@ function App() {
19931997 < h3 > Why this violates the rule</ h3 >
19941998 < ul >
19951999 < li >
1996- The form is ! immediately when the checkbox is checked — without
1997- user confirmation.
2000+ The form is submitted immediately when the checkbox is checked —
2001+ without user confirmation.
19982002 </ li >
19992003 < li >
20002004 Users may not expect a form to submit from a checkbox alone.
@@ -2036,7 +2040,7 @@ function App() {
20362040 : [ 'Services' , 'Home' , 'Contact' , 'About' ]
20372041 ) . map ( link => (
20382042 < li key = { link } >
2039- < a href = "#" > { link } </ a >
2043+ < a href = { `# ${ link . toLowerCase ( ) } ` } > { link } </ a >
20402044 </ li >
20412045 ) ) }
20422046 </ ul >
@@ -2096,6 +2100,13 @@ function App() {
20962100 < dialog ref = { consistentIdentificationDialogRef } >
20972101 < p > { consistentIdentificationModalContent } </ p >
20982102 < button
2103+ /**
2104+ * It's safe to disable the no-autofocus rule here because:
2105+ * - The button is inside a modal <dialog>, which demands immediate keyboard focus.
2106+ * - This improves accessibility by allowing keyboard and screen reader users to act quickly.
2107+ *
2108+ * eslint-disable-next-line jsx-a11y/no-autofocus
2109+ */
20992110 autoFocus
21002111 onClick = { ( ) => {
21012112 setConsistentIdentificationModalContent ( null ) ;
@@ -2140,15 +2151,15 @@ function App() {
21402151 < h3 > Page 1</ h3 >
21412152 < p > Content of page 1</ p >
21422153 < div className = { styles . helpLinkTopRight } >
2143- < a href = "#" > Need help?</ a >
2154+ < a href = "#help " > Need help?</ a >
21442155 </ div >
21452156 </ div >
21462157
21472158 < div className = { styles . page } >
21482159 < h3 > Page 2</ h3 >
21492160 < p > Content of page 2</ p >
21502161 < div className = { styles . helpLinkBottomLeft } >
2151- < a href = "#" > Support</ a >
2162+ < a href = "#support " > Support</ a >
21522163 </ div >
21532164 </ div >
21542165 </ div >
@@ -2480,6 +2491,12 @@ function App() {
24802491 </ header >
24812492
24822493 < div className = { styles . nameRoleValue } >
2494+ { /**
2495+ * This is an intentionally inaccessible "checkbox"
2496+ * without role, name, and keyboard support.
2497+ *
2498+ * jsx-a11y/click-events-have-key-events
2499+ */ }
24832500 < div
24842501 className = { styles . checkbox }
24852502 onClick = { ( ) => setIsChecked ( prevState => ! prevState ) }
0 commit comments