monkeytype/frontend/static/funbox
Nad Alaba 4318601799
fix(funbox): caret/tape/ui issues in backwards funbox (@NadAlaba) (#6956)
### Description

1. refactor:
- store (language direction / state of direction reversing funbox) in
test-state.ts, and set them on `TestLogic.init()` which is called on
each restart which happens on each change of Config.language or funbox.
- use these new direction variables in (caret.ts / test-ui.ts /
pace-caret.ts /result-word-highlight.ts) instead of calling `await
JSONData.getCurrentLanguage(Config.language)`.

2. css changes:
- add `unicode-bidi: bidi-override;` to .words with ligatures in
backwards to fix the direction of LTR words on LTR languages in custom
tests (which now have `.withLigatures` class regardless of language).
- remove `direction: rtl;` from right to left .word and keep it on right
to left #words. This was done because after adding the above
`bidi-override`, (.word)s directioin was being forced to rtl on tests
with RTL language and RTL words (custom and none custom tests), which is
wrong (should be ltr on those tests because of the backwards funbox).
- P.S., removing this from .word does not affect normal tests, because
.word direction is inherited from #words directtion on non
.withLigatures tests (e.g, non custom tests in non withLigatures
languages), and it is calculated using internal browser algorithm based
on characters used in .withLigatures tests (tests in languages with
ligatures and all custom tests).

3. add the property "reverseDirection" to backwards funbox, which
signifies that the direction of the test should be the reverse of the
direction of Config.language, and the direction of a word should be the
reverse of `Strings.isWordRightToLeft()`.

4. allow backwards funbox to work on languages with ligatures.

5. move `void Caret.updatePosition()` call to after the call of
`TestUI.lineJump()` in `input-controller.ts:handleSpace()`.

6. change name of `Strings.getWordDirection()` to
`Strings.isWordRightToLeft()` which explains what does the returned
boolean mean, and add a parameter `reverseDirection` that flips the
final result if true.

---------

Co-authored-by: Miodec <jack@monkeytype.com>
2025-09-19 22:15:03 +02:00
..
asl.css feat(funbox): add ASL (@fehmer) (#6485) 2025-04-23 18:45:52 +02:00
backwards.css fix(funbox): caret/tape/ui issues in backwards funbox (@NadAlaba) (#6956) 2025-09-19 22:15:03 +02:00
choo_choo.css fix(funbox): fix animations for choo_choo and earthquake funboxes in custom mode (@ShizukoV) (#6815) 2025-08-04 15:11:28 +02:00
crt.css fix: crt not applied to typo hints (@fehmer) (#6103) 2024-12-23 14:39:21 +01:00
earthquake.css fix(funbox): fix animations for choo_choo and earthquake funboxes in custom mode (@ShizukoV) (#6815) 2025-08-04 15:11:28 +02:00
mirror.css
nausea.css impr: allow multiple funboxes with css (@notTamion, @miodec, @fehmer) (#6017) 2025-02-04 17:52:50 +01:00
read_ahead.css
read_ahead_easy.css
read_ahead_hard.css
round_round_baby.css
simon_says.css
space_balls.css
tts.css
upside_down.css