Avoid swipe to dismiss errors being logged.#25139
Conversation
| * @param {!SwipeDef} data | ||
| */ | ||
| swipeGesture_(data) { | ||
| // Check if the carousel has been cleared out due to close. It is unclear |
There was a problem hiding this comment.
The carousel is created on the first tap (I believe), so could it be a race condition where someone taps lightbox for the first time, and then triggers a swipe before the carousel has been initialized?
There was a problem hiding this comment.
My thought is that the gestures are coming in out of order. If data.first doesn't come first, we'll have a null element reference.
There was a problem hiding this comment.
The carousel is created on the first tap (I believe), so could it be a race condition where someone taps lightbox for the first time, and then triggers a swipe before the carousel has been initialized?
I'm not sure, since the gesture is actually set up on the carousel element itself.
There was a problem hiding this comment.
My thought is that the gestures are coming in out of order. If
data.firstdoesn't come first, we'll have a null element reference.
Yeah that is possible, would need to investigate that possibility,
There was a problem hiding this comment.
I thought it was the swipe element that was null, not the carousel? The swipe element gets initialized in the startSwipe, which happens when data.first is true.
It does not seem like this error should be causing any problems (since the error will just occur in the touch handler for the carousel, which has been nulled out due to the lightbox closing), but adding a check here to avoid logging errors.
I have not been able to reproduce the original error message through testing, but it seems like this change should avoid it.
Closes #22533