Use mousedown event so view switches before blur event prevents the switch (https://github.com/woocommerce/woocommerce-blocks/pull/2129)
This commit is contained in:
parent
cc3ed31feb
commit
5d2a630a07
|
@ -41,8 +41,15 @@ const ViewSwitcher = ( {
|
||||||
isPrimary={ currentView === view.value }
|
isPrimary={ currentView === view.value }
|
||||||
isLarge
|
isLarge
|
||||||
aria-pressed={ currentView === view.value }
|
aria-pressed={ currentView === view.value }
|
||||||
|
onMouseDown={ () => {
|
||||||
|
if ( currentView !== view.value ) {
|
||||||
|
setCurrentView( view.value );
|
||||||
|
}
|
||||||
|
} }
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
setCurrentView( view.value );
|
if ( currentView !== view.value ) {
|
||||||
|
setCurrentView( view.value );
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
>
|
>
|
||||||
{ view.name }
|
{ view.name }
|
||||||
|
|
Loading…
Reference in New Issue