Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPEX-2801 - fix Carousel block on WP 6.2 #2525

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

snovosel-godaddy
Copy link
Contributor

Description

Screenshots

Types of changes

How has this been tested?

Acceptance criteria

Checklist:

  • My code is tested
  • My code follows accessibility standards
  • My code has proper inline documentation
  • I've included any necessary tests
  • I've included developer documentation
  • I've added proper labels to this pull request

Comment on lines 75 to 77
swiperWrapperRef.current.removeEventListener( ( 'mousedown' ), ( e ) => e.stopPropagation() );
if ( swiperWrapperRef && swiperWrapperRef.current ) {
swiperWrapperRef.current.removeEventListener( ( 'mousedown' ), ( e ) => e.stopPropagation() );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using the optional chaining operator? We can do this instead:

Suggested change
swiperWrapperRef.current.removeEventListener( ( 'mousedown' ), ( e ) => e.stopPropagation() );
if ( swiperWrapperRef && swiperWrapperRef.current ) {
swiperWrapperRef.current.removeEventListener( ( 'mousedown' ), ( e ) => e.stopPropagation() );
}
swiperWrapperRef?.current?.removeEventListener( ( 'mousedown' ), ( e ) => e.stopPropagation() );

Where the ?. operator will only execute if exists otherwise is equivalent to null. This is basically the same as checking the property first.

@AnthonyLedesma AnthonyLedesma merged commit e7f02fd into master Apr 11, 2023
@AnthonyLedesma AnthonyLedesma deleted the WPEX-2801__fix-carousel-with-go-62 branch April 11, 2023 18:38
@EvanHerman EvanHerman added this to the 3.0.3 milestone Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants