React: Custom Element's size attribute isn't rendered

Created on 16 May 2018  路  4Comments  路  Source: facebook/react

Do you want to request a feature or report a bug?

Report a possible bug.

What is the current behavior?

Most of my custom element's attributes render, but the size attribute does not. It appears to be stripped out by React.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

I am testing a Web Component integration with React. Given a collection of possible attributes and values to test, I map through them and create multiple buttons,

[
...
  {
    href: 'https://google.com/',
    text: 'Link',
    id: 'c'
  },
  {
    size: 'jumbo',
    text: 'Jumbo',
    id: 'd'
  },
...
]
<dls-button key={id} href={href} label={label} size={size} theme={theme} type={type} width={width}>{text}</dls-button>

The href, label, theme, type, and width attributes are rendered when they have a value, as expected. However, the size attribute is missing.

What is the expected behavior?

The size attribute and its value should be rendered.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

[email protected]
Google Chrome 66.0.3359.139

All of this custom element's attributes function as expected when integrated with Angular or in a vanilla setup, but not with React.

Most helpful comment

All 4 comments

Found this pre-existing issue and PR with a fix https://github.com/facebook/react/issues/12694 / https://github.com/facebook/react/pull/12702.

I'm not intimately familiar with React's release cycles--when is this likely to be in a release? Want to figure out if I should work around it in my code for the time being. If it will be published soon (as in, within a month or so) I can wait on it. Otherwise, I might need to work around the problem.

Within a month, definitely.

Awesome, thanks very much!

Was this page helpful?
0 / 5 - 0 ratings