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.

More flexibility for templating output component

See original GitHub issue

I’d love to use this module but would like to do some different things with the output component. I’m not sure what the best way to approach this would be — whether providing a slew of new options, or a templating system that would allow custom, or something else.

Here are things that I would like to do:

  • Check propTypes to ensure that the user has provided style.width and style.height, which are often necessary for IE.
  • Add focusable="false" to the every svg element.
  • Add an aria-labelled attribute to the svg element whose value is a generated id that is used by a <title> element that is the first child of the svg, which receives this.props.title.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sleexyzcommented, Oct 12, 2017

For anybody who might be looking at this and wonder how to add focusable="false" on every SVG element:

The following is a way to do this in your webpack config, provided you are on react-svg-loader@^2.0.0:

      {
        test: /\.svg$/,
        use: [
          {
            loader: "babel-loader"
          },
          {
            loader: "react-svg-loader",
            options: {
              svgo: {
                plugins: [
                  { addAttributesToSVGElement: { attributes: [ 'focusable="false"' ] } }
                ]
              }
            }
          }
        ]
      }

You could do this for any attribute. For example, we needed aria-hidden="true" on every SVG element

0reactions
petermikitshcommented, Jun 10, 2019

@sleexyz Thank you for sharing how to add focusable='false' to all SVG elements. Your configuration worked for my webpack setup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using templates and slots - Web Components | MDN
This article explains how you can use the <template> and <slot> elements to create a flexible template that can then be used to...
Read more >
Implementing Flexible Training Templates: Why and How
In summary, using a flexible template is a viable autoregulation strategy and can be implemented with varying degrees of flexibility. Remember, ...
Read more >
Extension of <template> - web components - WICG
Advantages: Most flexibility per template output. Precompilation of library code would be possible internally by browsers.
Read more >
Flexible Website Templates | Website design - Top Floor
Say hello to flexible website development templates! ... flexible template design as a collection of reusable components assembled to build ...
Read more >
tornado.template — Flexible output generation
tornado.template — Flexible output generation¶. A simple template system that compiles templates to Python code. Basic usage looks like: t = template.
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