Skip to content

[TreeView] Clean label editing code#14264

Merged
flaviendelangle merged 7 commits intomui:masterfrom
flaviendelangle:label-input-cleanup
Sep 2, 2024
Merged

[TreeView] Clean label editing code#14264
flaviendelangle merged 7 commits intomui:masterfrom
flaviendelangle:label-input-cleanup

Conversation

@flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Aug 19, 2024

No description provided.

@flaviendelangle flaviendelangle added the scope: tree view Changes related to the tree view. This includes TreeView, TreeItem. label Aug 19, 2024
@flaviendelangle flaviendelangle self-assigned this Aug 19, 2024
@mui-bot
Copy link

mui-bot commented Aug 19, 2024

Deploy preview: https://deploy-preview-14264--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 3cb705c

@@ -1,8 +1,12 @@
export interface TreeItem2LabelInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid to add props we don't actually use to the typing of our slots.
That way people implementing custom slots only need to support the props we actually need and not all the props we could theoretically use on our default slot component.

UseTreeViewLabelSignature,
} from './useTreeViewLabel.types';

export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used

experimentalFeatures: 'labelEditing';
dependencies: [UseTreeViewItemsSignature];
}>;
export interface UseTreeItem2LabelInputSlotPropsFromItemsReordering
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the name and the props were never added to the typing of UseTreeItem2LabelInputSlotProps

return {};
}

const handleKeydown = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move those two callbacks here, that way useTreeItem2 is totally agnostic of anything regarding this prop
We have some infos about label editing in other slots but nothing too important

@flaviendelangle flaviendelangle changed the title Label input cleanup [TreeView] Clean label editing code Aug 19, 2024
@flaviendelangle flaviendelangle marked this pull request as ready for review August 19, 2024 16:52
Copy link
Contributor

@noraleonte noraleonte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tree view Changes related to the tree view. This includes TreeView, TreeItem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants