Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Nov 19, 2019
1 parent dce6294 commit abe4412
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/block-library/src/gallery/gallery-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class GalleryImage extends Component {
// by the figure element or any of its children but only if
// the element that gained focus isn't any of them.
//
// debouncedOnSelect is scheduled every time figure or any of its children
// is blurred and cancelled when any is focused. If neither gain focus,
// debouncedOnSelect is scheduled every time a figure's children
// is blurred and cancelled when any is focused. If none gain focus,
// the call to onDeselect will be executed.
//
// onBlur / onFocus events are quick operations (<5ms apart in my testing),
Expand Down Expand Up @@ -106,10 +106,18 @@ class GalleryImage extends Component {
}
}

/**
* Note that, unlike the DOM, all React events bubble,
* so this will be called after the onBlur event of any figure's children.
*/
onBlur() {
this.debouncedOnDeselect();
}

/**
* Note that, unlike the DOM, all React events bubble,
* so this will be called after the onBlur event of any figure's children.
*/
onFocus() {
this.debouncedOnDeselect.cancel();
}
Expand Down

0 comments on commit abe4412

Please sign in to comment.