@@ -82,7 +82,7 @@ export class Block extends Component<BlockProps> {
8282 super ( props ) ;
8383
8484 this . handleBlockClick = this . handleBlockClick . bind ( this ) ;
85- this . handleBlockHover = this . handleBlockHover . bind ( this ) ;
85+ this . handleChallengeClick = this . handleChallengeClick . bind ( this ) ;
8686 }
8787
8888 handleBlockClick = ( ) : void => {
@@ -91,13 +91,8 @@ export class Block extends Component<BlockProps> {
9191 toggleBlock ( block ) ;
9292 } ;
9393
94- /*
95- * This function handles the block hover event.
96- * It also updates the URL hash to reflect the current block.
97- */
98- handleBlockHover = ( ) : void => {
94+ handleChallengeClick = ( ) : void => {
9995 const { block } = this . props ;
100- // Convert block to dashed format
10196 const dashedBlock = block
10297 . toLowerCase ( )
10398 . replace ( / \s + / g, '-' )
@@ -181,11 +176,7 @@ export class Block extends Component<BlockProps> {
181176 */
182177 const LegacyChallengeListBlock = (
183178 < Element name = { block } >
184- < div
185- className = { `block ${ isExpanded ? 'open' : '' } ` }
186- onMouseOver = { this . handleBlockHover }
187- onFocus = { this . handleBlockHover }
188- >
179+ < div className = { `block ${ isExpanded ? 'open' : '' } ` } >
189180 < div className = 'block-header' >
190181 < h3 className = 'big-block-title' > { blockTitle } </ h3 >
191182 { blockLabel && < BlockLabel blockLabel = { blockLabel } /> }
@@ -224,7 +215,12 @@ export class Block extends Component<BlockProps> {
224215 </ span >
225216 </ div >
226217 </ button >
227- { isExpanded && < ChallengesList challenges = { extendedChallenges } /> }
218+ { isExpanded && (
219+ < ChallengesList
220+ challenges = { extendedChallenges }
221+ onChallengeClick = { this . handleChallengeClick }
222+ />
223+ ) }
228224 </ div >
229225 </ Element >
230226 ) ;
@@ -236,11 +232,7 @@ export class Block extends Component<BlockProps> {
236232 */
237233 const ProjectListBlock = (
238234 < Element name = { block } >
239- < div
240- className = 'block'
241- onMouseOver = { this . handleBlockHover }
242- onFocus = { this . handleBlockHover }
243- >
235+ < div className = 'block' >
244236 < div className = 'block-header' >
245237 < h3 className = 'big-block-title' > { blockTitle } </ h3 >
246238 { blockLabel && < BlockLabel blockLabel = { blockLabel } /> }
@@ -255,7 +247,10 @@ export class Block extends Component<BlockProps> {
255247 </ div >
256248 ) }
257249 </ div >
258- < ChallengesList challenges = { extendedChallenges } />
250+ < ChallengesList
251+ challenges = { extendedChallenges }
252+ onChallengeClick = { this . handleChallengeClick }
253+ />
259254 </ div >
260255 </ Element >
261256 ) ;
@@ -267,11 +262,7 @@ export class Block extends Component<BlockProps> {
267262 */
268263 const LegacyChallengeGridBlock = (
269264 < Element name = { block } >
270- < div
271- className = { `block block-grid ${ isExpanded ? 'open' : '' } ` }
272- onMouseOver = { this . handleBlockHover }
273- onFocus = { this . handleBlockHover }
274- >
265+ < div className = { `block block-grid ${ isExpanded ? 'open' : '' } ` } >
275266 < BlockHeader
276267 blockDashed = { block }
277268 blockTitle = { blockTitle }
@@ -305,6 +296,7 @@ export class Block extends Component<BlockProps> {
305296 challenges = { extendedChallenges }
306297 isProjectBlock = { isProjectBlock }
307298 blockTitle = { blockTitle }
299+ onChallengeClick = { this . handleChallengeClick }
308300 />
309301 </ div >
310302 </ >
@@ -353,6 +345,7 @@ export class Block extends Component<BlockProps> {
353345 challenges = { extendedChallenges }
354346 blockTitle = { blockTitle }
355347 jumpLink = { ! accordion }
348+ onChallengeClick = { this . handleChallengeClick }
356349 />
357350 </ div >
358351 </ >
@@ -368,11 +361,7 @@ export class Block extends Component<BlockProps> {
368361 */
369362 const LegacyLinkBlock = (
370363 < Element name = { block } >
371- < div
372- className = 'block block-grid grid-project-block'
373- onMouseOver = { this . handleBlockHover }
374- onFocus = { this . handleBlockHover }
375- >
364+ < div className = 'block block-grid grid-project-block' >
376365 < div className = 'tags-wrapper' >
377366 < span className = 'cert-tag' aria-hidden = 'true' >
378367 { t ( 'misc.certification-project' ) }
@@ -394,9 +383,7 @@ export class Block extends Component<BlockProps> {
394383 < h3 className = 'block-grid-title' >
395384 < Link
396385 className = 'block-header'
397- onClick = { ( ) => {
398- this . handleBlockClick ( ) ;
399- } }
386+ onClick = { this . handleChallengeClick }
400387 to = { link }
401388 >
402389 < CheckMark isCompleted = { isBlockCompleted } />
@@ -423,8 +410,6 @@ export class Block extends Component<BlockProps> {
423410 </ Element >
424411 < div
425412 className = { `block block-grid block-grid-no-border challenge-grid-block ${ isExpanded ? 'open' : '' } ` }
426- onMouseOver = { this . handleBlockHover }
427- onFocus = { this . handleBlockHover }
428413 >
429414 < BlockHeader
430415 blockDashed = { block }
@@ -461,9 +446,13 @@ export class Block extends Component<BlockProps> {
461446 blockTitle = { blockTitle }
462447 isProjectBlock = { isProjectBlock }
463448 jumpLink = { false }
449+ onChallengeClick = { this . handleChallengeClick }
464450 />
465451 ) : (
466- < ChallengesList challenges = { extendedChallenges } />
452+ < ChallengesList
453+ challenges = { extendedChallenges }
454+ onChallengeClick = { this . handleChallengeClick }
455+ />
467456 ) }
468457 </ div >
469458 </ div >
@@ -477,8 +466,6 @@ export class Block extends Component<BlockProps> {
477466 </ Element >
478467 < div
479468 className = { `block block-grid challenge-grid-block ${ isExpanded ? 'open' : '' } ` }
480- onMouseOver = { this . handleBlockHover }
481- onFocus = { this . handleBlockHover }
482469 >
483470 < BlockHeader
484471 blockDashed = { block }
@@ -516,9 +503,13 @@ export class Block extends Component<BlockProps> {
516503 challenges = { extendedChallenges }
517504 blockTitle = { blockTitle }
518505 isProjectBlock = { isProjectBlock }
506+ onChallengeClick = { this . handleChallengeClick }
519507 />
520508 ) : (
521- < ChallengesList challenges = { extendedChallenges } />
509+ < ChallengesList
510+ challenges = { extendedChallenges }
511+ onChallengeClick = { this . handleChallengeClick }
512+ />
522513 ) }
523514 </ div >
524515 </ div >
@@ -539,6 +530,7 @@ export class Block extends Component<BlockProps> {
539530 completedCount = { completedCount }
540531 courseCompletionStatus = { courseCompletionStatus ( ) }
541532 handleClick = { this . handleBlockClick }
533+ onLinkClick = { this . handleChallengeClick }
542534 isCompleted = { isBlockCompleted }
543535 isExpanded = { isExpanded }
544536 percentageCompleted = { percentageCompleted }
0 commit comments