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.

Implementation for displaying error validations

See original GitHub issue

I am trying to use this to display error validations on my screen. So, if there are any errors, i want to show it and not hide it unless i explicitly call hide(). Also, i dont want the option to show the tooltip on hover, after hiding it explicitly. So, for this i am using the disable attribute conditionally.

I am facing some issues in implementing the above things :-

  • If we use the show method, would it continue to show the tooltip unless hover/click is performed? ReactTooltip.show(findDOMNode(this.refs.summary)); What i could see is that, it shows the tooltip but on hover it goes away. I tried using the “eventOff” props by setting it to click, but it still gets hidden on hover.

  • I dont want to show the tooltip on hover, instead always control the visibility via show() and hide() only. I am not able to do this. I also tried to use “disable” attribute conditionally, but this just works for the first instance. So, if data is valid i am disabling the tooltip in the below fashion.

    But what i see happening is that, if i keep my mouse pointer static without moving and then fixing the data validation to make disabled attribute as true, it gets disabled properly. But if the tooltip is enabled, and i move around my mouse pointer outside of the tooltip area, the tooltip doesnt get disabled even after the disabled attribute is set to true. <ReactTooltip id='summaryErrorToolTip' type='error' disable={data.isValid}> <span>Invalid Data</span> </ReactTooltip>

TL;DR: I need to control tooltips entirely via hide() and show() and disable the feature of hiding tooltips on hover/click.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
wwaynecommented, Sep 14, 2016

@RanjithNair I was thinking it would be useful if ReactTooltip.hide is able to hide a specific tooltip, so in latest 3.1.8, it start to support ReactTooltip.hide(findDOMNode(this.refs.foo)).

And now you can use scrollHide=false and resizeHide=false to prevent hiding tooltip from scrolling or resizing the window. You can check more detail in README.

1reaction
wwaynecommented, Sep 13, 2016

@RanjithNair I build a small example for you:

<div>
      <p ref= 'test' data-tip data-for='summaryErrorToolTip'>hehehhehe</p>
     <button onClick={() => { ReactTooltip.show(findDOMNode(this.refs.test)) }}>Show</button>
     <button onClick={() => { ReactTooltip.hide() }}>Hide</button>
     <ReactTooltip id='summaryErrorToolTip' type='error' place='bottom' event='nothing'>
          <span>Invalid Data</span>
      </ReactTooltip>
</div>

Let me explain:

  1. Previously, you set event-off doesn’t work because event-off must be set with event together, it just used to specify which event to hide the tooltip when use has already set custom event to show the tooltip, and if user only set event, tooltip will show and hide by that event. So here I set a event='whatever', then tooltip will have no idea how to show and hide tooltip by itself
  2. Pretty much : )
Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement Form Validation (Error to EditText) in Android
So in this article, it's been discussed step by step how to give the error texts to the user. Have a look at...
Read more >
How to Report Errors in Forms: 10 Design Guidelines
7. Don't Validate Fields Before Input is Complete. In most cases, avoid showing the error until the user has finished with the field...
Read more >
Creating a Reusable Display for Validation Errors and ...
This completes error handling in Reactive forms. Lets now get to TemplateDrivenFormComponent,where the error display logic is the same. What changes here is...
Read more >
Client-side form validation - Learn web development | MDN
Client-side form validation sometimes requires JavaScript if you want to customize styling and error messages, but it always requires you to ...
Read more >
Validation and Error Reporting
Specify how field validation errors should be displayed. 'Block' displays errors under the field. 'Tip' creates a pop-up error when hovering over the...
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