Wikipedia talk:Tools/Navigation popups

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This page is for discussing Navigation popups and reporting bugs you encounter with it. Please be aware that the original author of Popups (Lupin) is no longer active on Wikipedia. All issues are handled at the discretion of other experienced editors. Note that this project has an associated Phabricator project where implementation-related discussion happens.

Not sure how to explain your problem clearly? Read How to Report Bugs Effectively for some general pointers.

Some common questions are answered in the FAQ.


Hint/tooltip glitches[edit]

Good day,

The altering of the action object property in the getPrintFunction function, in these two cases (lines 5679 and 5688):

	case 'unwatch': case 'watch':
		this.print=magicWatchLink; this.action=this.id+'&autowatchlist=1&autoimpl=' + popupString('autoedit_version') + '&actoken='+autoClickToken(); break;
	case 'delete':
		this.print=wikiLink; this.action='delete';
		if (this.article.namespaceId()==pg.nsImageId) {
			var img=this.article.stripNamespace();
			this.action+='&image='+img;

and its use for retreiving the i18n tooltip in the wikiLink function (line 6174):

	var hint=popupString(l.action + 'Hint'); // revertHint etc etc etc

result in tooltips with url code between the action term and 'Hint', like: un|watch for any watch/unwatch, and delete for images (hover to see). I guess the altering of action needs to be moved to the switch statement in the wikiLink function (starting at line 6178).

Another one is email user – the i18n key 'EmailuserHint' (line 7049) needs a capital U.

With kind regards — Mar(c). 12:20, 7 January 2019 (UTC)

IPv6 /64 ranges[edit]

It would be useful if links for IPv6 addresses (in contributions and watchlists), when moused over, could have an option to produce a list of contributions for the /64 range to which the address belongs instead of just the specific /128 address.[1]

One way to do this would be by splitting the link into two pieces, like this:

2A02:C7F:202:7500:14B3:9AA7:46A3:B9E0

When you mouse over the left side, you should get the contribs for the 2A02:C7F:202:7500::0/64 range (which currently doesn't work). When you mouse over the right side, you get the contribs for just the specific 2A02:C7F:202:7500:14B3:9AA7:46A3:B9E0/128 address.

References

  1. ^ As I understand it, IPv6 addresses are typically allocated in /64 blocks for each user by the provider. E.g., instead of your ISP allocating you a single IPv4 address of 189.201.223.245 (/32), and your router doing network address translation to your internal network of about 256 addresses in a block like 192.168.1.0/24 in a private use range, for IPv6 they will allocate 2A02:C7F:202:7500::0/64 to you and your internal network devices are assigned their addresses from that block (2A02:C7F:202:7500::0 through 2A02:C7F:202:7500:FFFF:FFFF:FFFF:FFFF).

Navigation popup in visual diff[edit]

Since some weeks in german WP the visual diff view is active. But there the navigation popups dont work. They works only if I switch to the old wikitext mode. Is there a bug, or must I do some settings? Technical (I am web developer): It seems to me, there exists no event listeners for mouse movement.--Hlambert63 (talk) 17:42, 18 April 2023 (UTC)[reply]

It’s not implemented. Patches welcome —TheDJ (talkcontribs) 18:09, 18 April 2023 (UTC)[reply]
I think it should be implemented in visual diffs, not NavPopups, so I reported it at phab:T335199. —Tacsipacsi (talk) 16:28, 21 April 2023 (UTC)[reply]
@Tacsipacsi Yes, I would think so.
BTW: Today in 2 Diffs it worked, but at other didnt work. Dont know why.--Hlambert63 (talk) 14:13, 22 April 2023 (UTC)[reply]
It might be a race condition: if the visual diff loads first, by the time NavPopups loads, the diff is there and therefore the popups are added; however, if NavPopups loads first, it doesn’t find the visual diff on load, and later it doesn’t check it again (due to visual diffs not notifying it by firing the hook). —Tacsipacsi (talk) 00:43, 23 April 2023 (UTC)[reply]
@Tacsipacsi When the timing is the reason: Is it possible to load or re-ping / restart the NavPopups later in my Users common.js? (currently I activated it via a checkbox in my Settings)
At the console I saw, my common.js is called late, and if its too early, I'll find a way to defer a subfunction for a few seconds. Hlambert63 (talk) 18:16, 29 December 2023 (UTC)[reply]

I have found a 2nd bug: In Visual Diff the links to references leads to the article diff, I'd expect a link to the ref in ref-section (but it may be a collision with other popup-tools / -settings! – sorry *streichel* – I know a bulk of incoming bugs! ;-) )--Hlambert63 (talk) 18:04, 4 June 2023 (UTC)[reply]

Section preview[edit]

Hi! Kind regards. I wanted to ask if the gadget allows to preview specific section in articles. Pinging @Tesugi:, who had the original question. NoonIcarus (talk) 07:50, 27 July 2023 (UTC)[reply]

Revisit a popup[edit]

I'm delighted with what appears when I hover over a link. However, when I hover over the same link again later, I sometimes see just the article title and no content. It happens mainly (perhaps exclusively) when I hover over a redirect then slide the pointer onto the target to see the start of the target article. Do other users also see this? If so, would it be easy to change the behaviour so the start of the article text appears again? Certes (talk) 19:35, 2 August 2023 (UTC)[reply]

I can reproduce that bug. For example: The WP:POPFAQ link initially shows the redirect-target's content, but the 2nd mouseover doesn't. Quiddity (talk) 22:09, 2 August 2023 (UTC)[reply]
I found that using the "popups / reset" function will restore the initial behaviour. -- Michael Bednarek (talk) 01:15, 3 August 2023 (UTC)[reply]
Thanks for the tip. I've done that successfully, so this is not urgent missing functionality, purely a convenience issue of not having to click Reset. Certes (talk) 07:58, 3 August 2023 (UTC)[reply]
https://phabricator.wikimedia.org/T348606 Jidanni (talk) 09:30, 14 October 2023 (UTC)[reply]

mobile/responsive/touch/Android usability issue with touch versus mouse[edit]

as of 2023-08-17, and already a couple of weeks before that, the usability of "Navigation popup" has regressed (at least to my observation) on mobile browsers (tested with Firefox Android and Chrome Android... maybe the issue always existed, but I didn't notice it before):

When using mobile / touch devices, the popup appears when long-touching a link. Long-touching a link is the typical interaction to open a context menu with the intention to open that link in an additional tab/window.

on mobile devices with their small screen, an unintended popup appearance obscures a significant share of the current viewport content.

While technically long-touching results in mouseenter/mouseover/mousemove/focus events firing (therefore causing "Popup Navigation" to notice), there are means to better disambiguate a user's actual intentions on mobile phones.

See:

Abdull (talk) 22:16, 17 August 2023 (UTC)[reply]

Opening text not appearing in popups for some articles[edit]

There are articles such as Lebanon and Economy of Lebanon for which the opening text doesn't appear under the metadata in the popup as it does for most articles. Is it some template placed in front of the lead that's causing this? Largoplazo (talk) 03:30, 24 September 2023 (UTC)[reply]

I suspect that happens when articles have an extraordinary long infobox, and popups doesn't get to the beginning of the prose. Same thing happens at United States. -- Michael Bednarek (talk) 04:34, 24 September 2023 (UTC)[reply]
Infoboxes generally have a table class parameter matching infobox.*; could the parser see that and skip the table? Orange Suede Sofa (talk) 05:50, 24 September 2023 (UTC)[reply]
No. Popups has it's own preview system based on full wikitext of the article. It doesn't actually render any of the wikitext. The extract/abstract have to be within the first 10k characters. And in this case the infobox is... well... quite long ;). The text ends with "ethnic_groups" parameter at the moment. Nux (talk) 21:34, 24 September 2023 (UTC)[reply]
Infoboxes, including long ones, being a reality, I wonder whether the popup code could be modified to skip it rather than counting on there to be plain text within the first 10K characters. Largoplazo (talk) 21:53, 24 September 2023 (UTC)[reply]
I think the easiest fix would be to modify an option for yourself(s): `window.popupMaxPreviewCharacters = 8000;`. Popups takes double that to generate a preview.
I guess that the preview could be optimized by doing a quick search for multiline templates on top and removing them before doing anything else... Would not be easy though. Would require testing on slow PC to see if using a simple template parser would be fast enough. I mean I have something like that, but not sure if that would be faster then the killer function in Popups (probably more accurate, but might not be faster). Nux (talk) 21:55, 24 September 2023 (UTC)[reply]
A modern version of Popups that augments the software's built-in preview function (which is able to deal with Economy of Lebanon) by all of the nice links we use and love it for would be really nice. —Kusma (talk) 22:05, 24 September 2023 (UTC)[reply]
@Kusma the new core preview function has it's own problems. Doesn't even try to handle anything outside the main namespace... And sometimes doesn't even handle main namespace (phab:T346686, phab:T272394). Nux (talk) 22:12, 24 September 2023 (UTC)[reply]
Do you know what “doesn't even try to handle anything outside the main namespace” means? Does the backend it uses provide no information on non-mainspace pages, or does just the frontend not query that information? If the latter, that wouldn’t affect NavPopups. For the mainspace bugs, the current preview could be kept as a backup, especially as the new “core” preview function is actually not MediaWiki core, but an extension, so third-party users of NavPopups may not have it. —Tacsipacsi (talk) 07:26, 25 September 2023 (UTC)[reply]
@Tacsipacsi it's by design. I did some tests recently (due to some bugs in the pagepreviews) and when you move an article from the main namespace to the user namespace the API will no longer generate an abstract. Apparently this is be design, but seems like a bit weird choice (if for nothing else, it makes testing hard). There are other weird design choices -- e.g. it removes born/died info from a bio (which I find important). As for the placement in code -- you are right, the API comes from mw:Extension:Popups too (didn't notice that before). A longer description is on mw:Page Previews and subpages. Nux (talk) 12:05, 25 September 2023 (UTC)[reply]
That doesn't happen here. For me, popups in the User space look no different, i.e. any page in Special:AllPages/User: or Special:AllPages/User_talk:. It even shows the broom in User:Nux/Code Cleanup. -- Michael Bednarek (talk) 13:25, 25 September 2023 (UTC)[reply]
I don't know why they used the name "Popups" for the extension. Maybe Lupin should've trademarked that ;). The popups extension is something different then the actual Popups (gadget). The extension uses this API: api/rest_v1/page/summary/User:Nux%2FCode_Cleanup (notice empty extract on the bottom of JSON). Nux (talk) 13:35, 25 September 2023 (UTC)[reply]
Hence why Nux said "the new core preview function has its own problems", because it doesn't match what the Navigation Popups renders (which you likely use). New also being relative btw. as it's already 9+ years old now. A significant number of the readers will not even have been born when Navigation Popups was written (2005). The first iPhone is 4 years younger than this gadget, the Wikimedia foundation had just started and had not hired its first employee yet. websites were mostly still text only, as images were 'expensive'. —TheDJ (talkcontribs) 15:13, 25 September 2023 (UTC)[reply]
My mistake. I was talking about the subject of this talk page, "Navigation popups" and didn't read Nux closely enough to notice that he was talking about "Page Previews". -- Michael Bednarek (talk) 16:31, 25 September 2023 (UTC)[reply]

No dab links when using {{Place name disambiguation}}[edit]

{{geodis}} is a redirect to {{Place name disambiguation}}. However, if I use the latter on a disambigution page, popups will not display any dab links. Popups will only show the links if {{geodis}} is used. Is this a bug or intentional? RedWolf (talk) 03:22, 26 October 2023 (UTC)[reply]

I can't duplicate that behaviour. Here, hovering over Central Coast (which uses {{place name disambiguation}}) or Clark County (which uses {{geodis}}) both yield pop ups with their content. The difference I notice is that the pop ups for the former don't offer "Click to disambiguate this link to:", which is annoying and might be worth fixing. -- Michael Bednarek (talk) 05:16, 26 October 2023 (UTC)[reply]
Yes, when I said it will not display dab links, I meant the "Click to disambiguate..." followed by each of the links. I just changed Mount Reynolds back to using {{place name disambiguation}} and it currently illustrates the issue. I wonder if the number of redlinks it currently has is what is causing the issue. In the case of Central Coast I wonder if the headings are causing the issue. RedWolf (talk) 19:08, 26 October 2023 (UTC)[reply]
Looking at some of pages that use pnd that also show the issue: Elbow Lake, Minnesota, Highland, Indiana, Dickinson, New York, Buckingham Township, Pennsylvania. Those are all pages with just 2-4 links and no headings. RedWolf (talk) 19:19, 26 October 2023 (UTC)[reply]
Indeed it depends on the template name. This is again an ancient feature that doesn’t make use of features introduced to MediaWiki in the past decade or so. It matches the page wikitext against the regexp
/\{\{\s*(d(ab|isamb(ig(uation)?)?)|(((geo|hn|road?|school|number)dis)|[234][lc][acw]|(road|ship)index))\s*(\|[^}]*)?\}\}|is a .*disambiguation.*page/im
instead of relying on the presence of the __DISAMBIG__ magic word. —Tacsipacsi (talk) 21:05, 26 October 2023 (UTC)[reply]
Apparently, {{Place name disambiguation}}, and others, call {{dmbox|type=disambig}} which then emits that magic word. Could Popups use that? Which text is interrogated by that regex? The wikitext an editor sees, or an expanded version that gets displayed? Can Popups see categories applied by templates, or only those specified in the wikitext? -- Michael Bednarek (talk) 14:27, 27 October 2023 (UTC)[reply]
It matches against the wikitext an editor sees. It could be modified to match against the expanded version, but I think it would be easier and more performant (no need to download the whole expanded wikitext), and in any case would work more reliably across wikis (no need to create a local list of disambiguation templates specifically for NavPopups) to look for __DISAMBIG__ or its translated version by querying page properties: https://en.wikipedia.org/w/api.php?action=query&prop=pageprops&titles=Main%20Page%7CCentral%20Coast%7CClark%20County&ppprop=disambiguationMain Page doesn’t have "pageprops": {"disambiguation": ""}, while both Central Coast and Clark County have. —Tacsipacsi (talk) 10:25, 28 October 2023 (UTC)[reply]
I've been reading up on this at mw:Extension:Disambiguator and came to the same conclusion. I guess such an API query could then replace the regex? Who can implement that? -- Michael Bednarek (talk) 12:19, 28 October 2023 (UTC)[reply]
I think so. Anyone who understands the code can make an edit request. (I may give it a try, but not now, and I can’t promise anything.) —Tacsipacsi (talk) 23:18, 28 October 2023 (UTC)[reply]
I went the easier route, modifying my popups configuration:
popupDabRegexp='(\\{\\{\\s*disambig(?!uation needed)|disambig\\s*\\}\\}|disamb\\s*\\}\\}|disambiguation\\}\\}​|dab\\s*\\}\\})|\\{\\{\\s*(((geo|hn|road?|school|number)dis)|[234][lc][acw]|(road|ship)index)(\\s*[|][^}]*)?\\s*[}][}]|is a .*disambiguation.*page';
by adding |disambiguation\\}\\} capturing "disambiguation}}", and it works. -- Michael Bednarek (talk) 01:23, 29 October 2023 (UTC)[reply]
PS: I just noticed that I took the code for popupDabRegexp from the overleaf documentation as my starting point, not from mw:Gadget-popups.js; they are slightly different. The decentralised discussions and documentation are irritating. -- Michael Bednarek (talk) 01:48, 29 October 2023 (UTC)[reply]

I now took the regex at mw:Gadget-popups.js as my starting point and came up with:

popupDabRegexp='disambiguation\\}\\}|\\{\\{\\s*(d(ab|isamb(ig(uation)?)?)|disambiguation\\}\\}|(((geo|hn|road?|school|number)dis)|[234][lc][acw]|(road|ship)index))\\s*(\\|[^}]*)?\\}\\}|is a .*disambiguation.*page';

YMMV. -- Michael Bednarek (talk) 02:28, 29 October 2023 (UTC)[reply]

Not working on Wikispecies[edit]

This template recently stopped working, for me at least (I've asked, but have had no response from other users there), on Wikispecies. I cannot figure out why. Can anyone help, please? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 14:02, 23 December 2023 (UTC)[reply]

@Pigsonthewing You can load popups from enwiki directly. E.g. you can load like this. -- Nux (talk) 17:16, 23 December 2023 (UTC)[reply]
@Nux: Thank you. That's a useful work-around, but I'd still like to identify and fix the issue, for the benefit of others. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 17:41, 23 December 2023 (UTC)[reply]

New timestamp links[edit]

Talk page timestamp links have been deployed to multiple wikis (all except English Wikipedia at the moment, example) and this gadget tries to show a preview when you hover on them, however as the fragment does not correspond to a section, the preview is always just of the entire talk page, which isn't very useful. I would suggest that any link with the class ext-discussiontools-init-timestamplink be ignored. More generally you may also want to ignore any hash fragment starting #c- or #h- as these don't correspond to a page section. ESanders (WMF) (talk) 13:05, 30 January 2024 (UTC)[reply]

@ESanders (WMF): I don't use this gadget, how can I opt in to use this new cool feature here? Nardog (talk) 06:02, 31 January 2024 (UTC)[reply]
The feature isn't available on English Wikipedia yet as we are still back-filling the index table required to do the redirecting when a comment is archived. In the meantime you can enable clickable timestamp links using my commentlinks.js user script (example). ESanders (WMF) (talk) 07:44, 31 January 2024 (UTC)[reply]

Javascript error[edit]

When I have Navigation Popups or Reference Tooltips on, I get barraged with the following: Javascript Error https://en.wikipedia.org/w/load.php?lang=en&modules=ext.popups.main&skin=monobook&version=1ul2s at line 35: Uncaught SyntaxError: Failed to execute 'closest' on 'Element': The provided selector is empty. czar 14:45, 30 January 2024 (UTC)[reply]

I think this is fixed now. Some other problem caused the problem with popups. See Wikipedia:Village_pump_(technical)#Empty_element_error?. You may need to do a hard reload, to clear out cached pages. --Salix alba (talk): 17:47, 30 January 2024 (UTC)[reply]

Logo used in place of lead image in popup[edit]

I noticed this hovering over a link for Eurofighter Typhoon - the article's infobox has both an SVG logo used in branding and an image of the plane. in the code, this is accomplished thus:

{|{{Infobox aircraft begin  
| name = Eurofighter Typhoon
| logo = File:Eurofighter logo.svg
| image = File:RAF Eurofighter EF-2000 Typhoon F2 Lofting-1.jpg

In this case, the popup displays the logo, which is less useful than showing the image. I guess it does need to be able to use either | logo or | image, but which is more appropriate is conditional - an example of an article with an infobox containing both an image and a logo where the logo is more appropriate would be Bayer. Improving this might be a pain - use the image by default, but the logo if the article is categorised using any of the categories within Category:Companies? One cookie (talk) 13:51, 6 February 2024 (UTC)[reply]

@One cookie: I wouldn't worry about it, as this tool is aimed at editors not readers. As the documentation says, the code just picks the first image it comes across in the wiki text. At User:John of Reading/X2 I've swapped the parameters over, and popups is displaying the plane rather than the logo. -- John of Reading (talk) 14:25, 6 February 2024 (UTC)[reply]
And on the page, the logo still leads the image. Looks like a solution to me. Thanks! One cookie (talk) 14:29, 6 February 2024 (UTC)[reply]

Feature request: popups at bottom of page should not be cut off by bottom of page[edit]

When hovering over a link that is near the bottom of a page, it'd be awesome if the popup was displayed at the top of the link instead of going out of frame at the bottom, just like classic article previews. Thanks a lot! Cocobb8 (💬 talk • ✏️ contribs) 16:20, 22 February 2024 (UTC)[reply]

By “classic article previews”, you mean mw:Page Previews, which is about a decade younger than NavPopups, right? 🙂 There are some differences (apart from the time difference of a decade) because of which the always-bottom display makes more sense in case of NavPopups than it would in case of Page Previews:
  • Page Previews always shows a constrained-length popup, while NavPopups popups can get very long (e.g. if I hover over the “contribs” link in your signature, I get a popup that’s almost twice as tall as my entire screen), thus
    • it’s much more likely that the popup doesn’t fit in the screen either way, and it’s even possible that it doesn’t fit the document; if a popup overflows at the bottom (or right) of the screen, browsers usually extend the scrollbar so that even the very bottom/right of it is visible, but if it overflows at the top (or left), it’s clipped and the overflowing part is inaccessible;
    • if some part of the popup doesn’t fit the screen, it makes more sense for it to be the bottom, as the first sentence of the article (which defines what it’s about), the latest page history entries (which are usually the most relevant) etc. are on the top.
  • NavPopups features a lot of tools and links, which are all at the top; if the popup was displayed on the top, one would move the pointer more to reach them. Page Previews has a single tool (the settings), which is hardly ever needed, its only purpose is to show the preview of the article. (Notice the difference in the name: Navigation popups is for navigation, Page Previews is for previews.) —Tacsipacsi (talk) 15:27, 23 February 2024 (UTC)[reply]
Ah, that makes much more sense, thank you! Cocobb8 (💬 talk • ✏️ contribs) 16:05, 23 February 2024 (UTC)[reply]

Hovering over topicons doesn't display hover text[edit]

Articles that are protected in some sort (such as the POPUPS page) have protection padlocks as topicons. They normally have hover text to indicate duration. However, navpops replaces that with a preview of the linked page, and doesn't display the hover text anywhere for some reason. Aaron Liu (talk) 11:41, 14 March 2024 (UTC)[reply]

Works for me; all redirects in Category:Wikipedia fully protected pages show the 1st paragraph of the target page. -- Michael Bednarek (talk) 12:43, 14 March 2024 (UTC)[reply]
I'm not saying it doesn't show the linked page; I'm saying that the hover text, like "Editing of this page is restricted to autoconfirmed users indefinitely", doesn't show. Aaron Liu (talk) 12:47, 14 March 2024 (UTC)[reply]

Feature request: Support for colored text[edit]

Hello!

I've come up with a potential upgrade that could make NavPopups even better than they already are:

Having preview popups support colored text would be a win! This would not find any uses in the mainspace, but would be quite useful in showing an accurate preview of people's user pages that include specially formatted/colored text.

Any thoughts?

Cheers, Cocobb8 (💬 talk • ✏️ contribs) 20:11, 27 March 2024 (UTC)[reply]