Open mikedidomizio opened 2 months ago
As far as I know
console.log(window);
There is no problem when annotated.
This issue seems to be handled by onToggle on the Client Side when an error occurs on the Server side.
As far as I know
console.log(window);
There is no problem when annotated.
That was more left in the code for someone to try. I've removed it to avoid confusion that it may be related to the issue.
When I tested it in canary, everything is working normally.
When I tested it in canary, everything is working normally.
The Next 15 example above is Canary 146, but I just checked Canary 152. Same result.
According to the HTML specification for <details>
it's not working as expected with Next@15, but again maybe it's the examples. If you can show an example that shows it working properly in Next@15, that would clarify things. Check the console between React/HTML and Next.js to see the difference on render.
Link to the code that reproduces this issue
https://github.com/mikedidomizio/details-element-in-Next-14
To Reproduce
First sorry that the GitHub link is for Next14, it doesn't matter here
The
<details>
HTML element is an accordion style HTML tag that can show and hide information.The
onToggle
event is expected to automatically fire on render if open is set to true DocumentationBelow are CodeSandbox examples, the way to see if it automatically fire is to open the developer tools console and see that a console.log is either done or not.
In HTML it works that way ā
In React 19 it works that way ā
In React 18 it works that way ā
In Next.js 15 it doesn't seem to work that way š¤
In Next.js 14 it doesn't seem to work that way š¤
So HTML/React will automatically trigger the
onToggle
event on render ifopen
is set totrue
, but not Next.js.Is this a bug or am I doing something wrong with the Next example?
(Originally posted on the Discord/Forum)
https://github.com/user-attachments/assets/f70b5f76-e31a-4072-8de8-35a6ace844f6
Current vs. Expected behavior
Current behaviour:
Expected behaviour:
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
I tested with building a production build with static export as well, same thing, no auto-fire.