Dj-Viking/Nomad-Lang

FE [bug]: Tooltips appearing when they don't necessarily need to

Aperta

#79 aperta il 24 lug 2022

 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (1 fork)auto 404
FrontEndbuggood first issue

Metriche repository

Star
 (1 stella)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

here's an example. the main reason is because the code responsible for applying the tooltip text to the button is checking the length of the string being input to the choice button instead of how many words are in the string.

feel free to experiment with different sizes of answer texts that are inserted to the choice buttons and adjust the limits in the if statement check.

I have an idea that we can check for both conditions for example:

    const str_len = str.split("").length;
    const words_amount = str.split(" ").length;
    
    if (str_len >= 8 && words_amount >= 5) {
        // apply tooltip to the element
    }

Currently looks like this

Guida contributor