mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[tree view] Add prop to disable type-ahead focusing

Open ohmsl opened this issue 2 years ago • 3 comments

Expected Behaviour

<SimpleTreeView disableTypeAheadFocusing>
     <TreeItem
      itemId={id}
      label={label}
     />
</SimpleTreeView>

Temporary Workaround

This simple workaround works, but it also disables more useful keyboard navigation like the arrow keys.

<SimpleTreeView onKeyDownCapture={(e) => e.stopPropagation()}>
     <TreeItem
      itemId={id}
      label={label}
     />
</SimpleTreeView>

Search keywords: type ahead, focusing, single character

ohmsl avatar Oct 15 '24 19:10 ohmsl

Hi Thanks for your issue.

You can use event.defaultMuiPrevented = true to only prevent the MUI logic without totally stopping the propagation. The following example should keep all the other keyboard interactions.

I'm keeping this issue with "Waiting for upvote" for a built-in support. And I will fire a pull request to make MuiCancellableEventHandler which I uses in this example public :+1:

flaviendelangle avatar Oct 16 '24 07:10 flaviendelangle

Thank you Flavien 🙏🏼

ohmsl avatar Oct 16 '24 09:10 ohmsl

This did not gain a lot of interest in the last 2 years, so I will close this as not planned. There is a workaround available though so you can use that for your use case.

michelengelen avatar Oct 30 '26 15:10 michelengelen