material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[material-ui][ListItem] Remove props which have been deprecated since 2021

Open DiegoAndai opened this issue 1 year ago • 10 comments

Remove props deprecated since May 2021 (https://github.com/mui/material-ui/pull/26446):

  • autoFocus
  • button
  • disabled
  • selected

The ContainerComponent and ContainerProps will be handled in https://github.com/mui/material-ui/issues/41281

Search keywords: deprecated listitem

DiegoAndai avatar Feb 27 '24 18:02 DiegoAndai

~~Is this open? Can I assign myself to this?~~ I have taken this up since no one is assigned to it and it's ready to take.

thathva avatar Mar 01 '24 00:03 thathva

Correct me if I am wrong, the changes would be:

  • To the ListItem API in the material-ui package by removing the listed props and its dependencies.
  • Modify the documentation in material-ui and remove the props from the list of props.

thathva avatar Mar 04 '24 03:03 thathva

Hey @thathva, sorry for the late reply. Yes, feel free to work on this.

The changes would be:

  • Remove the props from the ListItem component
  • Remove the props from ListItem.d.ts
  • Run pnpm proptypes and pnpm docs:api which should update the documentation

We'll make this change in v6 alpha, so the PR for this change should point to the next branch. That branch doesn't exist now but should be created within the next week.

Feel free to let me know if you need any help.

DiegoAndai avatar Mar 06 '24 13:03 DiegoAndai

Hey @DiegoAndai! Thank you for the response! I was able to go ahead and do the changes as you mentioned and the API docs looks great so far. I just had couple of follow up questions:

  1. Would I need to update test cases as well? I see some test cases in ListItem.test.js using the deleted props.
  2. In the same ListItem.js file, I see some other references to the props that are to be deleted. Do I comment these out or remove it totally? For example, for autoFocus there is this bit of code:
 useEnhancedEffect(() => {
    if (autoFocus) {
      if (listItemRef.current) {
        listItemRef.current.focus();
      } else if (process.env.NODE_ENV !== 'production') {
        console.error(
          'MUI: Unable to set focus to a ListItem whose component has not been rendered.',
        );
      }
    }
  }, [autoFocus]);
  1. Should I remove the props for both the Props and CSS Classes or would just Props do?

thathva avatar Mar 06 '24 23:03 thathva

Hey @thathva!

  1. We should remove the tests that test the deleted prop. If a test is not testing the deleted prop but relies on it, we should refactor it.
  2. We should remove them totally.
  3. You mean the MuiListItem-button class? We should remove it.

DiegoAndai avatar Mar 08 '24 12:03 DiegoAndai

Hey @DiegoAndai I think I am done with all the changes. I have removed the said props from both the Props and CSS classes in the material-ui packages. The test cases were deleted as all were directly testing the prop. Can you let me know when I can raise a pull request and against which branch? Thanks!

thathva avatar Mar 11 '24 23:03 thathva

Hey! Here's the contributing guide that explains how to open pull requests: https://github.com/mui/material-ui/blob/master/CONTRIBUTING.md#sending-a-pull-request

We should open it against the next branch, which will be created next week. So we'll have to hold on until that.

DiegoAndai avatar Mar 12 '24 12:03 DiegoAndai

Hey! Please let me know when the next branch is created, so that I can raise a pull request against that. Thanks!

thathva avatar Mar 19 '24 01:03 thathva

Hey! It's now open 🎉 You can open the pull request.

DiegoAndai avatar Mar 19 '24 14:03 DiegoAndai

Hey @DiegoAndai I have raised a pull request against the next branch. Although it passes all the workflow actions, the Check if PR has label is failing, even though I seem to have followed the format 🤔. Let me know if I have to make any modifications to the code!

thathva avatar Mar 20 '24 01:03 thathva

Completed in https://github.com/mui/material-ui/pull/41566

DiegoAndai avatar Aug 08 '24 15:08 DiegoAndai