question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML Props, custom attributes, and and aria-labels aren't being converted to valid HTML element tags

See original GitHub issue

I’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 mean aria-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 lowercase datafaprocessed 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 lowercase dataprefix 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 lowercase dataicon 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
diligiantcommented, Nov 1, 2017

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 😀

0reactions
diligiantcommented, Nov 1, 2017

@robmadole don’t worry, you’ll hear for me 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found