In
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts
Custom initials in the line 32 are split by whitespace
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L32
to calculate length.
So if you pass A B, length will be calculated to 2.
However, on the line 49:
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L49
There is a simple substring that will return only the first character.
If you pass AB without space, it will calculate length to 1 and it will also return only first character.
So the only working way to use custom initials is to pass correct length via function args.
Solution is to split every character instead of splitting by space in line 32.
In
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts
Custom initials in the line 32 are split by whitespace
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L32
to calculate length.
So if you pass
A B, length will be calculated to2.However, on the line 49:
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L49
There is a simple substring that will return only the first character.
If you pass
ABwithout space, it will calculate length to1and it will also return only first character.So the only working way to use custom initials is to pass correct length via function args.
Solution is to split every character instead of splitting by space in line 32.