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

[core] feat(Dialog): add containerRef prop #5314

Merged
merged 9 commits into from
May 27, 2022

Conversation

dlichen
Copy link
Contributor

@dlichen dlichen commented May 23, 2022

Fixes #5273

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Adds a ref prop to dialog.

Reviewers should focus on:

I'm not entirely sure if this is the correct approach, also not completely sure how to test, so any feedback is welcomed.

Screenshot

n/a

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

Please add a unit test. You should be able to add a test for this in core/test/dialog/dialogTests.tsx... something like:

    it("supports ref objects attached to container", () => {
        const containerRef = React.createRef<HTMLDivElement>();
        mount(
            <Dialog containerRef={containerRef} usePortal={false}>
                body
            </Dialog>,
        );
        assert.isTrue(containerRef.current?.classList.contains(Classes.DIALOG_CONTAINER));
    });

packages/core/src/components/dialog/dialog.tsx Outdated Show resolved Hide resolved
@adidahiya adidahiya changed the title added a ref prop to Dialog [core] feat(Dialog): add containerRef prop May 24, 2022
@dlichen
Copy link
Contributor Author

dlichen commented May 24, 2022

Please add a unit test. You should be able to add a test for this in core/test/dialog/dialogTests.tsx... something like:

    it("supports ref objects attached to container", () => {
        const containerRef = React.createRef<HTMLDivElement>();
        mount(
            <Dialog containerRef={containerRef} usePortal={false}>
                body
            </Dialog>,
        );
        assert.isTrue(containerRef.current?.classList.contains(Classes.DIALOG_CONTAINER));
    });

added the test, but still need to test locally. can't seem to figure out yarn test. can hold off on reviewing

@adidahiya adidahiya merged commit 72fd50c into palantir:develop May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dialog should allow attaching ref to container element
2 participants