Skip to main content

Search and Top Navigation

#14962 closed bug (notabug)

Opened May 04, 2016 12:52PM UTC

Closed May 04, 2016 04:47PM UTC

Last modified May 04, 2016 10:18PM UTC

Tooltips shown automatically when entering page with a hash URL, :not doesn't work in selector

Reported by: Destroy666x Owned by:
Priority: minor Milestone: none
Component: ui.tooltip Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:
Description

I'm not sure whether it's a bug or I'm missing something, but:

jQuery: 1.11.3 and lower

Affected browsers: latest Chrome, latest Firefox, latest IE (that's what I tested with, probably all are affected)

OS: Windows 7 x64

How to reproduce:

1. Add an anchor element with name and title.

2. Add tooltips to document in $(document).ready (if you try to avoid the anchor with :not, it doesn't work).

3. Open page with the #name in the URL.

It will show a tooltip for the anchor that can be closed when you click on it. Expected - it shouldn't be shown at all.

If you use $(window).load instead of $(document).ready, it works better - it's shown only when you switch browser tabs. :not still doesn't do anything though.

Code:

http://jsbin.com/mecupu/edit?html,js

Test:

http://output.jsbin.com/mecupu#pid105

Same thing happens in 1.12 RC. If I choose to use the git version in JSbin, $(document).ready tooltips works like $(window).load and $(window).load tooltips don't work at all.

Attachments (0)
Change History (6)

Changed May 04, 2016 04:47PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

This is not a bug. By using the fragment identifier in the URL, you're placing focus on the anchor. Tooltips open on focus. Also, your selector for trying to exclude the anchor is wrong because you're selecting literally every element in the document other than the one anchor, which includes all the anchor's ancestors.

Changed May 04, 2016 06:52PM UTC by Destroy666x comment:2

Ok, thanks for info. Could you tell how can I prevent it in that case? Is there any way to add tooltips to everything but elements with one class? Or make the tooltip work only on hover, not focus?

Changed May 04, 2016 07:29PM UTC by Destroy666x comment:3

Never mind, it's as simple as $(document).tooltip().off('focusin focusout');

Changed May 04, 2016 08:43PM UTC by scottgonzalez comment:4

Is there any way to add tooltips to everything but elements with one class?

You should use the items options for that.

Or make the tooltip work only on hover, not focus?

PLEASE do not do this. You're breaking accessibility if you do.

Changed May 04, 2016 09:24PM UTC by Destroy666x comment:5

You should use the items options for that.

Ok, I see, thanks.

PLEASE do not do this. You're breaking accessibility if you do.

What exactly do you mean? If I don't want tooltips on focused inputs and links, what else could get broken? I guess tabindex and similar stuff, but it's definitely not a high priority feature for me.

Changed May 04, 2016 10:18PM UTC by scottgonzalez comment:6

There are users who don't, or can't, use pointing devices. Showing tooltips on focus is important for these users.