vmware-clarity / core

Clarity is a scalable, accessible, customizable, open-source design system built with web components. Works with any JavaScript framework, created for enterprises, and designed to be inclusive.
https://clarity.design
MIT License
166 stars 42 forks source link

React: CdsModal doesn't display when setting hidden={false} #122

Closed ashleyryan closed 2 years ago

ashleyryan commented 2 years ago

Describe the bug

When setting the hidden prop to false on the CdsModal component, the modal is not visible. React sends a string to the DOM, so the attribute is hidden="false" but the hidden attribute should be removed, not set to false. See the spect https://www.w3.org/TR/2008/WD-html5-20080610/semantics.html#boolean

How to reproduce

https://stackblitz.com/edit/clarity-react-8em3m2?file=src%2FApp.tsx

Notice how the modal only appears if you conditionally render the modal only when hidden is false, or if you convert false to undefined

Expected behavior

The Modal would be visible with hidden=false like it is in V5: https://codesandbox.io/s/goofy-cori-wyy4eq?file=/src/App.tsx

Versions

Clarity project:

Clarity version:

Framework:

Framework version: ie: Angular 11

Device:

Additional notes

Lit issue: https://github.com/lit/lit/issues/3053

Related (closed) React Issue: https://github.com/facebook/react/issues/9230#issuecomment-318512768

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 6.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 2 years ago

Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.