Template talk:Switcher
Would it be possible to have the radio button template brought over to enwiki from the Wikimedia Design Style Guide (similar to Template:Clickable button 2)? Its code can be found on https://doc.wikimedia.org/oojs-ui/master/demos/?page=widgets&theme=wikimediaui&direction=ltr&platform=desktop#icons-mediawiki-ltr. Thanks for looking into this! Daylen (talk) 04:46, 9 August 2018 (UTC) (Please ping me in your reply)
More aesthetic layout for many images
[edit]@PrimeHunter: Would it be possible to modify the template to allow for the organization of the clickable buttons in columns when there are above a certain number of images? Since the template accommodates up to 40 images, it is unwieldy to have a vertical list of 40, since that just takes up space. An example of this phenomenon is in my sandbox. Ergo Sum 17:38, 23 November 2019 (UTC)
- @Ergo Sum: The template uses MediaWiki:Gadget-switcher.js documented at User:Jackmcbarn/switcher. The script would have to add such a feature before the template can do it. I don't know enough JavaScript for this. You could post to MediaWiki talk:Gadget-switcher.js or notify Krinkle. PrimeHunter (talk) 19:19, 23 November 2019 (UTC)
- @PrimeHunter: Who is Krinkle? Ergo Sum 05:49, 25 November 2019 (UTC)
- @Ergo Sum: Krinkle has done maintenance on the script.[1]. The original author is inactive. PrimeHunter (talk) 13:17, 25 November 2019 (UTC)
- @PrimeHunter: Who is Krinkle? Ergo Sum 05:49, 25 November 2019 (UTC)
Which image to show first
[edit]Hi, for some applications such as a sequence of maps in chronological order, it can be useful to specify which image is the default. Is it possible to add an option specifying which radio button is pressed initially? Thanks. Zerotalk 13:29, 21 July 2020 (UTC)
- Hi Zero0000, at User:Jackmcbarn/switcher it says "If you want an element other than the first to be shown by default, add
data-switcher-default=""
to the switcher-label element." It uses MediaWiki:Gadget-switcher.js. Onceinawhile (talk) 16:04, 21 July 2020 (UTC)- Great, thanks. It should be documented here. Zerotalk 03:28, 22 July 2020 (UTC)
Switch buttons on top
[edit]Is there a way to change the template (or make a local version) so that the switcher option buttons are on top rather than the bottom? 23 October 2020
It doesn't work
[edit]It doesn't work in Mongolian Wikipedia. What might be a problem? BatlaaTs (talk) 16:00, 7 August 2022 (UTC)
- @BatlaaTs: It relies on code in MediaWiki:Gadget-switcher.js which is used as a gadget with this in MediaWiki:Gadgets-definition:
switcher[ResourceLoader|default|targets=desktop,mobile]|switcher.js
- MediaWiki:Gadget-switcher displays the text for the gadget at Special:Preferences#mw-prefsection-gadgets. The Mongolian Wikipedia doesn't currently have any gadgets. mn:MediaWiki:Gadgets-definition hasn't been created. PrimeHunter (talk) 21:25, 7 August 2022 (UTC)
- Appreciate it, thanks BatlaaTs (talk) 02:53, 8 August 2022 (UTC)
- and who can create that page? BatlaaTs (talk) 02:55, 8 August 2022 (UTC)
- @BatlaaTs: Both mn:MediaWiki:Gadget-switcher.js and mn:MediaWiki:Gadgets-definition can only be created or edited by an interface administrator (the Mongolian Wikipedia doesn't have any [2]) or a global interface administrator at meta:. Requests can be posted to meta:Steward requests/Miscellaneous but I'm not sure this specialized gadget is a good place to start. You can test it for yourself with this in mn:Special:MyPage/common.js:
mw.loader.load( '//wiki.riteme.site/w/index.php?title=MediaWiki:Gadget-switcher.js&action=raw&ctype=text/javascript' );
- PrimeHunter (talk) 03:37, 8 August 2022 (UTC)
Sidebar and buttons
[edit]When using the switcher for sidebars it displays the button on the left side of the page, as if under an image (see here). Can the buttons be somehow relocated to the bottom, under the sidebars, so it looks normal? Qwerty284651 (talk) 02:04, 9 October 2022 (UTC)
Spacing
[edit]Is someone able to add in a space ( ) between the radio button and the caption? It looks awful when the text is right up against the button. Cheers, Number 57 16:53, 26 November 2022 (UTC)
- @PrimeHunter: Sorry to bother you, but as you created the template, I wondered if you could do this? Cheers, Number 57 19:47, 28 November 2022 (UTC)
- @Number 57: The template uses User:Jackmcbarn/switcher which has no space. The template could automatically insert at the start of the specified texts to look like this (where was inserted manually):
- The "Show all" line is part of the underlying feature MediaWiki:Gadget-switcher.js and not part of the template so the template cannot add a space there as far as I know. I think it looks bad if the other lines have a space but not "Show all". You could suggest adding a space in all lines at MediaWiki talk:Gadget-switcher.js. Then the template doesn't have to do anything, and the space is also there when the underlying feature is used directly without the template. PrimeHunter (talk) 20:27, 28 November 2022 (UTC)
- Thanks – had tried to insert the space manually, but realised it couldn't be done with the 'Show all' button. Will ask at the MediaWiki page – thanks! Number 57 20:33, 28 November 2022 (UTC)
- Note: The proposed change is on MediaWiki_talk:Gadget-switcher.js#Space_between_the_button_and_text. cmɢʟee⎆τaʟκ 21:14, 10 July 2023 (UTC)
- Thanks – had tried to insert the space manually, but realised it couldn't be done with the 'Show all' button. Will ask at the MediaWiki page – thanks! Number 57 20:33, 28 November 2022 (UTC)
- The "Show all" line is part of the underlying feature MediaWiki:Gadget-switcher.js and not part of the template so the template cannot add a space there as far as I know. I think it looks bad if the other lines have a space but not "Show all". You could suggest adding a space in all lines at MediaWiki talk:Gadget-switcher.js. Then the template doesn't have to do anything, and the space is also there when the underlying feature is used directly without the template. PrimeHunter (talk) 20:27, 28 November 2022 (UTC)
TOC not working with switcher with subsections
[edit]When you click on the "Tier I (1990–2008)" subsection on TOC on page, which is inside the switcher module, but is not selected from the toggle buttons below, it won't switch to the subsection automatically. You have to click on the toggle buttons manually to switch to it. The default button is set to another subsection withing the same section. Can this somehow be fixed when I click on the TOC it opens that subsection, instead of opening it manually with the toggle button?
Off-topic: What is the difference between data-switcher-label-style="display:inline"
and data-switcher-top-choices=""
?
One more thing, is switcher accessibility-friendly or does it cause issues with screen readers? Does anyone know? Qwerty284651 (talk) 22:43, 10 December 2022 (UTC)
- @Qwerty284651: WTA 1000 Series singles records and statistics#Champions by year has an odd use of the template to show one of two completely different tables. I don't recommend that. I don't think it's possible to automatically open a switcher-hidden subsection when a TOC entry is clicked.
data-switcher-label-style="display:inline"
anddata-switcher-top-choices=""
at User:Jackmcbarn/switcher#Testing new features are for test code in User:Jackmcbarn/switcher-unstable.js. I haven't examined what it does and Jackmcbarn hasn't edited since January 2021.data-switcher-label-style
anddata-switcher-top-choices
are not in the live gadget code at MediaWiki:Gadget-switcher.js so they have no effect there. PrimeHunter (talk) 00:58, 11 December 2022 (UTC)- @PrimeHunter, what do you recommend I do then? Qwerty284651 (talk) 01:13, 11 December 2022 (UTC)
- @Qwerty284651: Always show both tables. See also MOS:DONTHIDE. PrimeHunter (talk) 01:19, 11 December 2022 (UTC)
- @PrimeHunter, does MOS:DONTHIDE apply also here: ATP Tour Masters 1000#Results aka is switcher's use suitable in said section? Qwerty284651 (talk) 01:36, 11 December 2022 (UTC)
- @Qwerty284651: That looks worse. Lots of readers will never discover they can click a button somewhere to see other years. PrimeHunter (talk) 01:44, 11 December 2022 (UTC)
- @PrimeHunter, got you. Whilst I was going for a narrower display of the article due to its length, I ended up exacerbating the look more than improving it. Duly noted for next time.
- P. S. Is this usage of switcher in anyway fitting? Qwerty284651 (talk) 02:03, 11 December 2022 (UTC)
- @Qwerty284651: It's much better because it switches a single element which easily fits within a page so the buttons are easy to see and use. I'm still not a fan but don't have a strong opinion against it. switcher is best when it's not just a way to save space but lets you view "the same" in different ways like location maps in infoboxes, e.g. Glamorgan. PrimeHunter (talk) 04:07, 11 December 2022 (UTC)
- Switcher's syntax IS native to the Location map module, so they go hand in hand. Qwerty284651 (talk) 04:18, 11 December 2022 (UTC)
- @Qwerty284651: It's much better because it switches a single element which easily fits within a page so the buttons are easy to see and use. I'm still not a fan but don't have a strong opinion against it. switcher is best when it's not just a way to save space but lets you view "the same" in different ways like location maps in infoboxes, e.g. Glamorgan. PrimeHunter (talk) 04:07, 11 December 2022 (UTC)
- @Qwerty284651: That looks worse. Lots of readers will never discover they can click a button somewhere to see other years. PrimeHunter (talk) 01:44, 11 December 2022 (UTC)
- @PrimeHunter, does MOS:DONTHIDE apply also here: ATP Tour Masters 1000#Results aka is switcher's use suitable in said section? Qwerty284651 (talk) 01:36, 11 December 2022 (UTC)
- @Qwerty284651: Always show both tables. See also MOS:DONTHIDE. PrimeHunter (talk) 01:19, 11 December 2022 (UTC)
- @PrimeHunter, what do you recommend I do then? Qwerty284651 (talk) 01:13, 11 December 2022 (UTC)
Switcher doesn't work with mobile app
[edit]It has been brought to my attention that this template does not work properly with the mobile app (although it does seem to work fine with the mobile website). If anyone has any idea of why this is or how to address this problem, I would appreciate it. Thanks. Master of Time (talk) 00:31, 30 March 2023 (UTC)
- I was coming here to report the same.
- It also doesn't work for me on web as apparently at some point the MediaWiki:Gadget-switcher.js got disabled so it looks very broken.
- Has anyone ever attempted improving this template so it degrades more gracefully and doesn't require JavaScript to work? Generally it's bad practice for templates to require a gadget to work. 🐸 Jdlrobson (talk) 19:12, 8 July 2024 (UTC)