Template talk:Rating

Needs alpha feature
Needs alphabetic ratings feature, such that
 * displays as EDCB A.

Compare:
 * displays as.

It might make more sense to do this as or

—  SMcCandlish  &#91;talk&#93; &#91;cont&#93; ‹(-¿-)› 15:01, 30 August 2008 (UTC)
 * Would it not be easier on readers to simply use "A" "B" "C", etc? I can see a EDCBA range as potentially very confusing to most...it certainly was to me. — Huntster (t • @ • c) 01:33, 1 September 2008 (UTC)
 * Fine by me; I was just trying to match the star formatting. —  SMcCandlish  &#91;talk&#93; &#91;cont&#93; ‹(-¿-)› 22:41, 14 September 2008 (UTC)

Accessibility issue
Has this been discussed at all with WP:WPACCESS? This template strikes me as likely to be an accessibility problem. —  SMcCandlish  &#91;talk&#93; &#91;cont&#93; ‹(-¿-)› 15:01, 30 August 2008 (UTC)
 * Very unlikely that it has been discussed with any group. My understanding was that it simply got made and folks began replacing the "Rating-X" templates. While not perfect, it does include alt-text, though the same alt text is replicated with each star image. — Huntster (t • @ • c) 01:33, 1 September 2008 (UTC)

How horrible this looks in text browsers: • displays as 4/5 stars4/5 stars4/5 stars4/5 stars4/5 stars • displays as 0/3 stars0/3 stars0/3 stars Jidanni (talk) 09:14, 13 September 2008 (UTC)
 * Indeed. I'm really not sure what might be the best way to solve this situation...cater to text-to-voice users, but not make text browsers look like mud. Perhaps use a 1x1 transparent image with the alt text? I do not know if there is a function in HTML to present alt text without using images. — Huntster (t • @ • c) 11:53, 13 September 2008 (UTC)

Let's see, if you only had the first item have the current ALT text, and the rest have ALT="" (I suppose, but not nothing at all otherwise some browsers will put the name of the image there), then • displays as 4/5 stars • displays as 0/3 stars Jidanni (talk) 04:15, 14 September 2008 (UTC)
 * I've edited the template accordingly, and it should hopefully just display the image text once now. --Conti|✉ 00:19, 15 September 2008 (UTC)

OK, looks good. Thanks. As a side effect this even exposed a bug in the w3m browser. Jidanni (talk) 14:59, 18 September 2008 (UTC)

Make images unclickable
I suggest adding "link=" to the images in order to make them unclickable. For instance:



SharkD (talk) 01:00, 30 March 2009 (UTC)
 * This is an excellent suggestion. I ran across this problem independently. Making all those stars clickable causes screen readers to say awful things like "4 slash 5 stars link star full dot S V G link star full dot S V G link star full dot S V G link star empty dot S V G link" for  (displays as ""). WP:ALT recommends using "|link=" for purely decorative images like this. I tested a fix in the sandbox with the test cases. Please install the fix into the main template. This should cause the same template to generate just "4 slash 5 stars link" in a screen reader. Thanks. Eubulides (talk) 09:34, 14 July 2009 (UTC)
 * It is not really consistent to have some of the stars linked and not others. Can you achieve this result using the alt parameter (which is not specified at all yet)? &mdash; Martin (MSGJ · talk) 09:56, 14 July 2009 (UTC)
 * Sure; that's nearly as easy. To do that, please install this sandbox change (which I've tested). This change does not say "|alt=", but it does specify the alt text, by using the old-fashioned Wikipedia image syntax. Eubulides (talk) 10:07, 14 July 2009 (UTC)
 * Sorry, I'm not with you. There doesn't seem to be any alternate text in it now. &mdash; Martin (MSGJ · talk) 11:46, 14 July 2009 (UTC)
 * The alt text is there; I just checked the HTML directly. Perhaps by "alt text" you meant the title text, which is commonly displayed as a tooltip? That's easy to fix too. The current template has flawed title text: with a graphical browser it displays e.g. "4/5 stars" in a tooltip only when you mouse over the first star; the other stars have irrelevant tooltips like "Star full.svg". I fixed it so that the tooltip says "4/5 stars" over all the stars, with this revised patch that should fix both the WP:ACCESSIBILITY and the tooltip bugs. Could you please install that instead? Thanks. Eubulides (talk) 20:20, 14 July 2009 (UTC)
 * ✅ Let me know if there are any problems, or anything else I can do to help. Plastikspork (talk) 23:56, 14 July 2009 (UTC)

Improved accessibility patch
Since the previous comment, the MediaWiki software has been changed so that one must now use "linkalt" instead of plain "link". Apparently this is a bug and will be fixed eventually, but in the meantime we have lots of articles using this template and the workaround is simple. While looking into this, I noticed that the lead star's alt text shouldn't be set either, as the title of the span suffices to get the tooltip working for all the stars. Accordingly, could you please install to improve accessibility further? Thanks. Eubulides (talk) 19:41, 26 September 2009 (UTC)
 * Done. — RockMFR 20:31, 26 September 2009 (UTC)
 * I've restored the lead star's alt text since a) the title doesn't show up without it in IE7 and b) text browsers would have nothing at all without the alt text. — RockMFR 20:45, 26 September 2009 (UTC)
 * Yes, you're right. Thanks for catching that. Eubulides (talk) 03:16, 27 September 2009 (UTC)

Usability problems
This template has some usability problems. For example, if a user sees this in an article, how is he to know whether it means "4 stars out of 4" or "4 stars out of 5"? Sure, this template displays "4 stars out of 5" differently, namely as, but how is a user who has just reached a particular article via Google to know that? (I've just discovered that there is a tool tip if you mouse over the stars, but this isn't immediately evident, it wasn't to me... Also, if you have to read a tool tip to discover what the image means, what's the point?) There are similar problems at the opposite end of the scale: Does  mean "1 star on a scale of 1 to 5" or "1 star on a scale of 0 to 5"? Here, the problem is not just with the display - the template doesn't allow you to specify a minimum rating. Eljayess (talk) 20:08, 27 September 2010 (UTC)
 * Completely agree. Some scales use zero as a scale, but others don't. :S Yves (talk) 10:30, 20 November 2010 (UTC)
 * I don't think this is a problem. The template is supposed to reflect the way it's presented by the reviewer, not explain someone else's rating system. — Bility (talk) 18:56, 15 February 2012 (UTC)

New template code
I made a new version of this template to accept just a single parameter for the number of stars (see /sandbox and /testcases) to better reflect reviewer ratings, not all of which use a "this many stars out of this many" format. This wouldn't change any existing usages (unless they're already missing the second parameter). Now the template outputs "Please specify a rating." if no second parameter is given, but the proposed change would just use the single parameter's input. Other minor changes: Pending consensus on the tracking category, that can be taken out if needed. So, thoughts? If there aren't any objections, I'll put up an edit request in a few days. Cheers, — Bility (talk) 22:44, 15 February 2012 (UTC)
 * 1) Took out the unnecessary alt parameters in the image markup
 * 2) Provided an alternate tooltip message if "n/n stars" doesn't fit.
 * 3) Added a tracking category for when a fraction of a star other than half is used, per this request.


 * Good work. I guess it's best to wait until an admin has implemented the amendments before we update the documentation page to make clear that the denominator is now optional and that all numbers must be a multiple of 0.5. — Richardguk (talk) 13:00, 19 February 2012 (UTC)
 * Looks good, ✅. It was also possible to simplify it a little bit due to changing how the alt text is handled. Tra (Talk) 20:50, 19 February 2012 (UTC)
 * Um, did you all not see the thread above where it was determined that alt text was necessary? I've had to restore the dispute tag up there as a result. — SMcCandlish    Talk⇒〈°⌊°〉 Contribs. 02:24, 20 February 2012 (UTC)
 * Ok, I've played around a bit with it in the sandbox. Looking at Template:Rating/testcases in, the sandbox version seems to work better for text only browsers. I'll check in some other browsers to make sure it all looks ok. Tra (Talk) 03:25, 20 February 2012 (UTC)
 * Changes made. Tra (Talk) 03:37, 20 February 2012 (UTC)
 * I still don't see a single alt= in there. Please see the above discussions in detail. — SMcCandlish   Talk⇒〈°⌊°〉 Contribs. 05:53, 20 February 2012 (UTC)
 * When the page is rendered, image tags of the form  are generated. If this wasn't what you had in mind, it would probably be easier to make the necessary changes to the template sandbox then use editprotected to request that they are copied over. Tra (Talk) 07:06, 20 February 2012 (UTC)
 * Erf. As I recall, the important part of the tweaking was to ensure that the first such image did appear with alt text like that, while the others were suppressed with blank alts, otherwise it reads out as "four slash five stars three slash five stars two slash five stars..."  — SMcCandlish    Talk⇒〈°⌊°〉 Contribs. 08:12, 20 February 2012 (UTC)

This change needs to be rolled back ASAP, for the reasons given above. Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 11:12, 25 February 2012 (UTC)
 * Could you clarify what the outstanding issues are? The problem with the alt text has, as far as I'm aware, been resolved. Tra (Talk) 12:30, 25 February 2012 (UTC)
 * As described by SMcCandlish in his comment time-stamped "08:12, 20 February 2012". I've re-enabled edit protected as this is a controversial change that needs to be rolled back; not a new change awaiting consensus. It can always be reapplied, once a fix is found. Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 17:08, 25 February 2012 (UTC)
 * That comment was about how the first image has to have alt text saying what the star rating is then subsequent images have blank alts. If you look at the template source code, you'll see that this is already the case (although I replaced the blank alts with dots but I'd be surprised if a screenreader read those out).
 * Additionally, as an example, displays  with html source code.
 * If we then look at only the alt text here as a screenreader would then we get
 * Addressing your other points, I would not characterise this as a controversial change. When I made the initial change, there were two editors who had expressed support for it. Afterwards, SMcCandlish raised an issue and that was resolved. Tra (Talk) 18:23, 25 February 2012 (UTC)
 * Yes, dots are read out by assistive software. And I see two of us, out of five in the discussion, opposing the change; plus the prior conversation referred to above. Incidentally, better alt text for the first image would be "four out of five stars". Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 19:57, 25 February 2012 (UTC)
 * Thank you for clarifying that it was the dots you were concerned about. This has now been fixed so the html tags have alt="" in them.
 * Looking at the prior conversation, I'm seeing Koafv proposing the change, PuppyOnTheRadio expressing a concern but then later on assisting in making the change, Redrose64 clarifying something, Richardguk expressing a concern but then supporting the change above, Bility assisting with making the change then raising it on this talk page (along with other changes), then I go ahead and make the change. Then after the change is made, we have you and SMcCandlish raising concerns.
 * I'm not going to revert it completely. The main reason for this is that a new feature (single parameter) has been introduced and to revert it could break any pages that are now using this feature.
 * With regards to using "out of", I agree that this would sound better if read aloud. But that is a separate change and I don't have time to do that today. I'll leave editprotected up in case any other admin wants to implement this. Tra (Talk) 20:56, 25 February 2012 (UTC)
 * Sounds good. — SMcCandlish   Talk⇒〈°⌊°〉 Contribs. 03:16, 26 February 2012 (UTC)

Image overrides
Added functionality in the /sandbox to override the images used in case of ratings that aren't in stars and for which we have an appropriate image (or someone could upload an appropriate image). Examples are in the /testcases. Could this be beneficial? Or at least no harm in adding? — Bility (talk) 00:45, 21 February 2012 (UTC)

No one has objected, and I've already found a few articles to use this in. Opening edit request. — Bility (talk) 18:36, 27 March 2012 (UTC)
 * Looks interesting, although I wonder in the test cases why you used File:Symbol wind speed 00.svg instead of File:U+25CB.svg. The pluralization could use some work though: see how displays "2 sheeps" and  displays "2 thumb ups". I'll have a look at adding a rating-plural, and I'll probably have it use plural to simplify the code.
 * Also, when you update the documentation, be sure to note that basically only public-domain images may be used with this feature. Most licenses, including GFDL and CC-BY-SA, require a link back to the image description page for attribution and/or statement of license. Anomie⚔ 20:44, 28 March 2012 (UTC)
 * Good points, both; I hadn't thought of the image licensing issue. Would it be too problematic to use images that link back to their description pages? And would most images, especially the simple colored circles, be able to use the same licensing as File:Star full.svg (not copyrightable as simple geometry) if they don't already? — Bility (talk) 21:32, 28 March 2012 (UTC)
 * Yes check.svg Done I also threw in size in to render the images larger than the default if necessary. Please update the documentation. Anomie⚔ 21:45, 28 March 2012 (UTC)

Edit request on 6 April 2012
I think the incorrect use message should have Please specify a rating. , which would produce Please specify a rating. This would make it easier to see in a piece of text when it is incorrectly used.

&#124; Randomno &#124;  WP 12:07, 6 April 2012 (UTC)
 * Sandbox updated and testcase added. — Bility (talk) 15:31, 6 April 2012 (UTC)
 * Yes check.svg Done -- Red rose64 (talk) 19:29, 10 April 2012 (UTC)

What about quarter or other fraction ratings?
Hi, I just mentioned this here because I encountered an unusual situation (it's unusual for the review site too, as far as I know this is the only instance). With this particular review, the rating is 4 and 1/4 stars. The current template will not generate this. Is there a way to correct this?-- &iquest;3fam  ily6  contribs 18:59, 11 May 2012 (UTC)
 * We have stayed away from fractional stars other than halves, mainly because other fractions are very rare. In this case you should probably use plain text, i.e. use 4.25/5 instead of rev1Score -- Red rose64 (talk) 19:47, 11 May 2012 (UTC)
 * Okay, I was wondering if I should do that. I was just that I was worried that if numbers or words shouldn't be converted to stars, the reverse would be true. But even if that's the case, the reviewer uses numeral/written notation at the end of the review, so it would be okay. Thanks!-- &iquest;3fam  ily6  contribs 20:48, 11 May 2012 (UTC)

non-graphical option
I'd like to see an option for dingbat-based display rather than images. E.g., ★/☆, ☺/☹, 👎/👍, ♥/♡, etc. If this is agreeable, maybe I'll start looking at possible ways to implement it. ⇔ ChristTrekker 14:50, 15 May 2013 (UTC)
 * That would assume that all users have the relevant fonts installed. This is demonstrably untrue: I see the third pair above as squares, containing the hexadecimal values 01F44E and 01F44D respectively. -- Red rose64 (talk) 17:44, 15 May 2013 (UTC)
 * The character positions of the third pair were defined only a couple years ago, granted. The others have been in Unicode for ~20 years and are included in many common fonts. Is there anything wrong generally with the idea of using dingbats, rather than specifically with which dingbats are used? ⇔ ChristTrekker 18:06, 15 May 2013 (UTC)
 * WP:ACCESS: what does screen-reader software make of them? With an image, you can set alt text reading e.g. "A yellow star" etc. -- Red rose64 (talk) 19:13, 15 May 2013 (UTC)
 * Reading "a yellow star a yellow star a yellow star" is not accessible, in terms of "does it communicate the intent". Neither is "***", though for years I've seen advice given for text-based browsers that "decorative" images have "", "*", or similar alt text. To be accessible, we should change this template to print "3 out of 5 stars", "2 thumbs up", or similar. Generally speaking, the conventional wisdom has been that a version that does not use images is more accessible than one that does. I won't argue that in this case, as this template explicit addresses a visual shorthand, but it is clear that a dingbat-based representation is no worse than a graphic-based representation. Dingbats will use less bandwidth and fit better with surrounding text.
 * It may be possible to be clever with CSS classes, so that different material is presented depending on the presentation (visual, vocal, etc). In terms of accessibility, that may be the best way to tackle this. Someone using Firefox+screenreader may not get this benefit (FF probably still loads the visual-mode styles), but someone with an actual audio browser should. ⇔ ChristTrekker 20:02, 15 May 2013 (UTC)
 * We suppressed the alt text for images and used the title attribute in a wrapper element to describe the rating as a whole (i.e. "m out of n stars", etc.). As this is a visual template, images are preferable to dingbats which may or may not be rendered and may or may not be readable or in an accurate color without extra coding. Bandwidth use is immaterial with images at these sizes. I don't see a reason to increase the template complexity for a feature that lowers the visual quality with no discernable benefit. — Bility (talk) 22:14, 15 May 2013 (UTC)

Color
I have added a color parameter to the Spanish version. I am missing a blue half star. This was done to support Euro NCAP pre-2009, Latin NCAP pre-2016 and Global NCAP pre-H2 2022. The half stars are not needed by NCAPs. Trigenibinion (talk) 20:51, 24 June 2022 (UTC)