vaadin / vaadin/framework

GenericFontIcon resource does not support fonts icons with multiple css classes

Open
#11,171 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Background

The GenericFontIcon class uses fontFamily attribute as css class on the client side. Following:

   button.setIcon(new GenericFontIcon("font-awesome-5-solid", 0x0f9));

results in client side:

  <span class="v-icon font-awesome-5-solid">ù</span>
Issue

It is not possible to specify multiple classes in that attribute. When I do this:

   button.setIcon(new GenericFontIcon("font-awesome-5-solid fa-spin", 0x0f9));

The (wrong) result is:

<span class="v-icon font-awesome-5-solid+fa-spin">ù</span>

Expected result:

<span class="v-icon font-awesome-5-solid fa-spin">ù</span>
What it is good for

I need multiple classes to use font awesome 5 animations.

How to fix it

The reason:

The solution would be to use URL.decodeQueryString method instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading server/src/main/java/com/vaadin/server/ResourceReference.java and client/src/main/java/com/vaadin/client/ui/FontIcon.java, following how fontFamily is encoded and decoded. Verify that a GenericFontIcon value containing multiple CSS classes is rendered with spaces between the classes rather than plus signs, matching the expected span output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.