@@ -661,7 +661,7 @@ const handleKeyDown = ({
661
661
const element = getTreeNode ( data , tabbableId ) ;
662
662
const id = element . id ;
663
663
if ( event . ctrlKey ) {
664
- if ( event . key === "a" ) {
664
+ if ( event . key === "a" && clickAction !== clickActions . focus ) {
665
665
event . preventDefault ( ) ;
666
666
const dataWithoutRoot = data . filter ( ( x ) => x . parent !== null ) ;
667
667
const ids = dataWithoutRoot
@@ -678,7 +678,8 @@ const handleKeyDown = ({
678
678
} ) ;
679
679
} else if (
680
680
event . shiftKey &&
681
- ( event . key === "Home" || event . key === "End" )
681
+ ( event . key === "Home" || event . key === "End" ) &&
682
+ clickAction !== clickActions . focus
682
683
) {
683
684
const newId =
684
685
event . key === "Home"
@@ -711,16 +712,18 @@ const handleKeyDown = ({
711
712
event . preventDefault ( ) ;
712
713
const previous = getPreviousAccessible ( data , id , expandedIds ) ;
713
714
if ( previous != null && ! disabledIds . has ( previous ) ) {
714
- dispatch ( {
715
- type : treeTypes . changeSelectMany ,
716
- ids : propagateSelect
717
- ? propagatedIds ( data , [ previous ] , disabledIds )
718
- : [ previous ] ,
719
- select : true ,
720
- multiSelect,
721
- lastInteractedWith : previous ,
722
- lastManuallyToggled : previous ,
723
- } ) ;
715
+ if ( clickAction !== clickActions . focus ) {
716
+ dispatch ( {
717
+ type : treeTypes . changeSelectMany ,
718
+ ids : propagateSelect
719
+ ? propagatedIds ( data , [ previous ] , disabledIds )
720
+ : [ previous ] ,
721
+ select : true ,
722
+ multiSelect,
723
+ lastInteractedWith : previous ,
724
+ lastManuallyToggled : previous ,
725
+ } ) ;
726
+ }
724
727
dispatch ( {
725
728
type : treeTypes . focus ,
726
729
id : previous ,
@@ -733,16 +736,18 @@ const handleKeyDown = ({
733
736
event . preventDefault ( ) ;
734
737
const next = getNextAccessible ( data , id , expandedIds ) ;
735
738
if ( next != null && ! disabledIds . has ( next ) ) {
736
- dispatch ( {
737
- type : treeTypes . changeSelectMany ,
738
- ids : propagateSelect
739
- ? propagatedIds ( data , [ next ] , disabledIds )
740
- : [ next ] ,
741
- multiSelect,
742
- select : true ,
743
- lastInteractedWith : next ,
744
- lastManuallyToggled : next ,
745
- } ) ;
739
+ if ( clickAction !== clickActions . focus ) {
740
+ dispatch ( {
741
+ type : treeTypes . changeSelectMany ,
742
+ ids : propagateSelect
743
+ ? propagatedIds ( data , [ next ] , disabledIds )
744
+ : [ next ] ,
745
+ multiSelect,
746
+ select : true ,
747
+ lastInteractedWith : next ,
748
+ lastManuallyToggled : next ,
749
+ } ) ;
750
+ }
746
751
dispatch ( {
747
752
type : treeTypes . focus ,
748
753
id : next ,
0 commit comments