Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FocusTrap] Convert focus trap to typescript #35005

Merged
merged 18 commits into from Dec 20, 2022

Conversation

trizotti
Copy link
Contributor

@trizotti trizotti commented Nov 4, 2022

closes #34722

@mui-bot
Copy link

mui-bot commented Nov 4, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35005--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against ceed9bd

@trizotti trizotti marked this pull request as ready for review November 4, 2022 17:07
@zannager zannager added the component: FocusTrap The React component. label Nov 7, 2022
@michaldudak
Copy link
Member

Thanks for working on this. Could you please also convert the test file to TS?

As for the test_static failing, changing the JSDoc of isEnabled in FocusTrap.types.ts to:

@default function defaultIsEnabled(): boolean {
  return true;
}

should help.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 28, 2022
@trizotti trizotti marked this pull request as draft November 28, 2022 13:53
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 30, 2022
@trizotti trizotti marked this pull request as ready for review November 30, 2022 13:43
@trizotti
Copy link
Contributor Author

@michaldudak , I just finished with the test file and all the checks are passing now.

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

Sorry it took so long. It got buried among other notifications.
It looks good in general. I have just a couple of minor remarks.

packages/mui-base/src/FocusTrap/FocusTrap.test.tsx Outdated Show resolved Hide resolved
packages/mui-base/src/FocusTrap/FocusTrap.test.tsx Outdated Show resolved Hide resolved
packages/mui-base/src/FocusTrap/FocusTrap.test.tsx Outdated Show resolved Hide resolved
trizotti and others added 3 commits December 14, 2022 17:15
Remove casting

Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
Signed-off-by: Trizotti <gootrizotti@gmail.com>
Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
Signed-off-by: Trizotti <gootrizotti@gmail.com>
Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
Signed-off-by: Trizotti <gootrizotti@gmail.com>
@trizotti
Copy link
Contributor Author

No problem, @michaldudak ... Thanks for the review. I added the suggested changes.

packages/mui-base/src/FocusTrap/FocusTrap.test.tsx Outdated Show resolved Hide resolved
packages/mui-base/src/FocusTrap/FocusTrap.test.tsx Outdated Show resolved Hide resolved
@@ -77,7 +85,7 @@ describe('<FocusTrap />', () => {
});

it('should warn if the root content is not focusable', () => {
const UnfocusableDialog = React.forwardRef((_, ref) => <div ref={ref} />);
const UnfocusableDialog = React.forwardRef<HTMLInputElement>((_, ref) => <div ref={ref} />);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be HTMLDivElement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I just fixed it.

Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
Signed-off-by: Trizotti <gootrizotti@gmail.com>
trizotti and others added 2 commits December 15, 2022 09:53
Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
Signed-off-by: Trizotti <gootrizotti@gmail.com>
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks a lot for your work!

@michaldudak michaldudak merged commit 8f0d81d into mui:master Dec 20, 2022
@trizotti trizotti deleted the convert-focus-trap-to-typescript branch December 20, 2022 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: FocusTrap The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FocusTrap][base] Convert code to TypeScript
4 participants