HTML Props, custom attributes, and and aria-labels aren't being converted to valid HTML element tags
See original GitHub issueI’m having an issue with a few attributes that aren’t being converted into HTML compliant element attributes correctly and React is throwing an error: I added the fields below
- ariaHidden (Warning: Invalid ARIA attribute
ariaHidden
. Did you meanaria-hidden
?) - dataFaProcessed (React does not recognize the
dataFaProcessed
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasedatafaprocessed
instead. If you accidentally passed it from a parent component, remove it from the DOM element.) - dataPrefix (React does not recognize the
dataPrefix
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasedataprefix
instead. If you accidentally passed it from a parent component, remove it from the DOM element.) - dataIcon (React does not recognize the
dataIcon
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasedataicon
instead. If you accidentally passed it from a parent component, remove it from the DOM element.)
I’m using React 16+, importing the Font Awesome 5 Pro Light icons explicitly from a custom directory (since its not available in the free version), and then passing them down as props to a containing component that has the FontAwesomeIcon component inside of it.
I added a brief example below
// FontAwesome is a webpack alias referring to where the custom font awesome assets are
// in this case it's where the light assets are stored
// Icons are passed as props when used
import { faRocket, faCog, faGroup, faBullhorn, faUser } from 'FontAwesome/light';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
export const Icon = ({ iconSize, icon, iconColor }) => (
<div styleName={`${iconSize} ${iconColor}`}>
<FontAwesomeIcon icon={icon} />
</div>
);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
aria-label - Accessibility - MDN Web Docs
The aria-label attribute defines a string value that labels an interactive ... attribute can be used with regular, semantic HTML elements; ...
Read more >HTML5 Custom Data Attributes (data-*) | HTML5 Doctor
How can I use data attributes? As custom data attributes are valid HTML 5, they can be used in any browser that supports...
Read more >ASP.NET Core Razor components - Microsoft Learn
Components are ordinary C# classes and can be placed anywhere within a ... The markup for using a component looks like an HTML...
Read more >FAQs - styled-components
Note: The subfunction object-form .attrs({ prop: props => {} }) syntax that was ... core index.html file (generated or static) within a typical...
Read more >How To Customize React Components with Props
Props are arguments that you provide to a JSX element in a React application. They look like standard HTML props, but they aren't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
IMHO, we don’t need the fa “data” properties. With React, it’s just useless (we don’t query/manipulate the DOM this way) and it bloats the rendering for nothing.
@supercodepoet and @robmadole do you have ideas on how to have ci “block” when the console screams errors and warnings (like it does on my setup)? It’s important that we trust the release process. Please 😀
@robmadole don’t worry, you’ll hear for me 😉