Merge pull request woocommerce/woocommerce-admin#2839 from cojennin/fix/2729-product-click

Product in dropdown clickable in FF/Safari
This commit is contained in:
Paul Sealock 2019-08-26 11:54:29 +12:00 committed by GitHub
commit 822f18c2be
1 changed files with 6 additions and 0 deletions

View File

@ -324,6 +324,12 @@ export class Autocomplete extends Component {
className={ classnames( 'woocommerce-search__autocomplete-result', className, { className={ classnames( 'woocommerce-search__autocomplete-result', className, {
'is-selected': index === selectedIndex, 'is-selected': index === selectedIndex,
} ) } } ) }
/*
* On FF and Safari, if <Button> contains interior DOM nodes (i.e., <span>)
* `handleFocusOutside` will be triggered before `onClick` and close the autocomplete.
* Prevent focus from shifting to these nodes with onMouseDown.
*/
onMouseDown={ ( e ) => e.preventDefault() }
onClick={ () => this.select( option ) } onClick={ () => this.select( option ) }
> >
{ option.label } { option.label }