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

SVG support #3

Closed
cimi opened this issue May 30, 2017 · 5 comments
Closed

SVG support #3

cimi opened this issue May 30, 2017 · 5 comments
Labels

Comments

@cimi
Copy link

cimi commented May 30, 2017

Nice library! I've just stumbled upon it today and played with it a bit.

I've tried using react-hint to add tooltips to SVG elements and it doesn't work. I'm guessing it's because it tries to inject 'plain' DOM elements (div, span) as the wrappers for the tooltip and that doesn't play well with SVG.

I've used redux-tooltip successfully with SVG. That library allows the user to specify a custom wrapper, for example if I put g as my preferred tag everything works nicely. Not sure how easy a change this is to make or there is any other SVG specific logic involved besides just switching tags.

@slmgc
Copy link
Owner

slmgc commented May 31, 2017

@cimi oh, that's an interesting use-case! Could you post a link to a fiddle with an example? I would like to figure out what's wrong as it seems that react-hint should work. Unless it's being placed inside of the SVG.

@slmgc
Copy link
Owner

slmgc commented Nov 18, 2017

I've checked react-hint with SVG and it worked just fine for me:
screen shot 2017-11-17 at 21 37 45
Please reopen in case you'll be able to provide a repro.

@slmgc slmgc closed this as completed Nov 18, 2017
@mockey-jockey
Copy link

using SVG react hint not working in IE11,Except IE for all browser working well.kindly help to resolve this

@mockey-jockey
Copy link

mockey-jockey commented Feb 14, 2018

@cimi @slmgc -->I fixed this issue ,element.dateset not working in IE,

<ReactHint events delay={100} onRenderContent={(element) => {
          if (element && element.dataset && element.dataset.rh) {
            return (<div className="react-hint__content">
              {element.dataset.rh.split("\n").map((content, i) =>
                <span key={i}>{content} {content && <br />}</span>
              )
              }
            </div>)
          }
          return null;

        }} />

changed to -------

<ReactHint events delay={100} onRenderContent={(element) => {
           if (element) {
            let datasetValue = element.getAttribute("data-rh");
            if(datasetValue){
              return (<div className="react-hint__content">
                {datasetValue.split("\n").map((content, i) =>
                  <span key={i}>{content} {content && <br />}</span>
                )
                }
              </div>)
            }                               
          }
          return null;

        }} />

Above code will work perfectly in IE11

@cimi
Copy link
Author

cimi commented Jun 10, 2018

Sorry for the super late reply!

Unless it's being placed inside of the SVG.

Yes, this is/was the problem. We've fixed and we're happy users of react-hint.

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

No branches or pull requests

3 participants