mirror of
https://github.com/lipis/flag-icons.git
synced 2026-04-26 09:25:50 +03:00
[GH-ISSUE #940] Reorder flags with the Unknown flag first on the list #445
Labels
No labels
3rd-party
3rd-party
bug
code
documentation
enhancement
fixed-in-master
flag-request
help needed
missing-flag
missing-flag
pull-request
wrong-flag
wrong-flag
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/flag-icons#445
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @colinj on GitHub (Mar 10, 2022).
Original GitHub issue: https://github.com/lipis/flag-icons/issues/940
My suggestion is that you should reorder the flag classes by placing the unknown flag (
xx) before all other flags.In terms of CSS precedence, if
.fi-fris placed on the same element as.fi-xx, the unknown flag will override the French flag due to the fact that the French flag is declared earlier than the Unknown flag. By declaring the Unknown flag first, means that every other flag will override it if they reside on the same element.So why would you want to declare both flags on the same element?
In my use case, I have a system that stores the 2-letter country code against items in a database. This allows me to display the relevant flag-icon on the page by adding the flag class to the span element (forgive me, I am using Vue):
Unfortunately, the data may contain invalid 2-letter country codes. (eg.
vb). To combat this, I would like it to display the "Unknown" flag as a fallback flag.For a country code of
vb, this would be translated toclass="fi fi-xx fi-vb". Since.fi-vbdoesn't exist, this gets ignored and.fi-xxwill produce the "Unknown" flag.For a country code of
fr, this would be translated toclass="fi fi-xx fi-fr". If.fi-frwas declared after.fi-xxthen the French flag should override the "Unknown" flag and page would display the French flag.Unfortunately, with
.fi-xxdeclared last, the above example will show the "Unknown" flag instead.Please consider this proposal as I think this would be a benefit for a lot of people using your library.
@colinj commented on GitHub (Apr 3, 2022):
I created a PR for this issue: https://github.com/lipis/flag-icons/pull/950