I'm working on tooltips, when I was told there are some tooltips that have close buttons. Is a tooltip with a close button user friendly?
To know if the tooltip should be closable by the user, we should know when it gets displayed.
In general I would provide a close button. Usually it doesn't destroy a design but most people will like it.
The thing with tooltips (as with everything else on screen) is that it increases cognitive load and requires to be processed (read) by the user.
So the general question to ask is: does the user need (or want) to see the tooltip permanently, or should be allowed to close it? Is the tooltip really helpful or trivial?
I'd say that tooltips in general need to be visible only as long as they convey important message to the user. So they should have close button or disappear themselves after some other user input (mouse hover, click on associated element, fixing the problem etc.), or time delay (but as it was stated in previous answers - it is at odds with good accessibility guidelines, so should be used only for trivial information).
In the current context what is shown in your screenshot I see two bad UX issues and would advise not to put close button on your tooltip.
I agree with Harijs' answer.
You need to address the question of why you are using the Tooltip for error handling in the first place. Here is a helpful article:
You should also not use tooltips for error messages.
Consider also the conditions to use Tooltips in the first place as outlined in another SE post here:
I highly recommend you try a different approach for your error handling especially within the login. Here are some great examples:
Using the whitespace on the right:
Below each field:
This example looks tooltip-esque but I believe the error message stays there as long as the validation marks it as wrong. It could be dynamic or when the user clicks on log in.
I would definitely use a close button on tooltips for websites that are responsive since there is no such thing as hover on a touch screen device.
This would be in cases where the tooltip is accessed via a click instead of a hover. In my work I strive to have a single method for accessing this type of information to keep a code base small and have the user only need to learn one way of doing things no matter which device they happen to be using right then.
In practice this has led me to avoid using hover at all because touch screen devices are becoming so popular.
I think for tooltips the "close" button serves the purpose of reassuring the user that this is indeed a tooltip and it can be closed. It's a quick fix for cases when users are inexperienced with interfaces, and definitely not a requirement.
Remember that you have to teach the users how to use your apps, not just give them "faster horses".
But in this specific example, I don't think this message should be shown in a tooltip, but in an appearing text field that lists all the encountered errors.