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

Boolean values not handled as expected for popover prop #4391

Closed
robertknight opened this issue May 20, 2024 · 0 comments · Fixed by #4393
Closed

Boolean values not handled as expected for popover prop #4391

robertknight opened this issue May 20, 2024 · 0 comments · Fixed by #4393
Labels

Comments

@robertknight
Copy link
Member

Describe the bug

The latest release adds the popover attribute with boolean as a supported type (see #4378). When setting this prop to a boolean value, I'd expect it to add or remove the popover attribute, but not set a value, like eg. the disabled prop. Instead it adds popover="true" or popover="false", stringifying the boolean value, like aria- attributes. This results in a warning from Chrome that the value is not allowed.

A workaround is to use the values "auto" and undefined to substitute for boolean true/false.

Tested with Preact v10.22.0.

To Reproduce

test.html:

<html>
  <body>
    <div id="app">
    <script type="module">
      import { render, h } from 'https://unpkg.com/preact?module';
      function App() {
        return h('div', { popover: true });
      }
      render(h(App), document.getElementById('app'));
    </script>
  </body>
</html>

Steps to reproduce the behavior:

  1. Open test.html in Chrome
  2. Observe warning in the logs: Found a 'popover' attribute with an invalid value. <div popover=​"true">​</div>​

Expected behavior

The above should render <div popup></div>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants