-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Any plans to add support for the HTMLDialogElement? #3294
Comments
Can anyone speak to the status of this? Receiving Break seems to be related to this change to |
The status is that we're waiting on you to submit a pull request implementing this feature :) |
I think #3403 fixes this. Workaround for
|
It would be great if this could get some more visibility / priority. Using the |
Adding to the workaround posted, if you are using Jest, this may help to do some assertions while we wait for #3403 to be merged. Mocks HTMLDialogElement.prototype.show = jest.fn(function mock(
this: HTMLDialogElement
) {
this.open = true;
});
HTMLDialogElement.prototype.showModal = jest.fn(function mock(
this: HTMLDialogElement
) {
this.open = true;
});
HTMLDialogElement.prototype.close = jest.fn(function mock(
this: HTMLDialogElement
) {
this.open = false;
}); Assertions: // Assert `<dialog>` is shown - probably not necessary in a test, but for proof the value is set
await waitFor(() => {
expect((screen.getByLabelText(/some aria-label on the dialog/i) as HTMLDialogElement).open).toBe(
true
);
});
// Assert some `<dialog>` content is shown. Should work as expected in `@testing-library`, for example.
await waitFor(() => {
expect(screen.getByText(/Some Title/i)).toBeVisible();
}); |
I get a ReferenceError: HTMLDialogElement is not defined |
@domenic I'd love to help contribute support for this better, but don't know what all this would entail. I'm an experienced engineer, but would love some guidance on what next steps would be so that I can open a PR to fix :) |
When implementing this, I think we should also implement the |
I am not sure if the current implementation supports it, but the "cancel" event would be a nice addition... |
Unfortunately [jsdom doesn’t support HTMLDialogElement](jsdom/jsdom#3294), so removes the `<dialog>` element from one of the demo components. This also fixes a JSX/SVG error.
Unfortunately [jsdom doesn’t support HTMLDialogElement](jsdom/jsdom#3294), so this removes the `<dialog>` element from one of the demo components. This also fixes a JSX/SVG error in the `Images` demo.
Unfortunately [jsdom doesn’t support HTMLDialogElement](jsdom/jsdom#3294), so this removes the `<dialog>` element from one of the demo components. This also fixes a JSX/SVG error in the `Images` demo.
I was lucky to find that happy-dom already have a very nice basic implementation it. It still lacks some things like |
Basic info:
Minimal reproduction case
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
The text was updated successfully, but these errors were encountered: