Page MenuHomePhabricator

Wikifunctions' function editing page doesn't explicitly specify lang and dir attributes for every input field
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  1. The chip with the alias "n!" appears as "!n".
  2. In every chip, the end of every English string is too close to the chip's right edge.
  3. The name appears as "!factorial". (I'd love to give you an example of a function name that actually includes punctuation for easy testing of LTR/RTL issues, but I couldn't find such a function. It may get created some day...)
  4. The text in all the input boxes, as well as the chips, are all aligned to the right.

Screenshot (after):

תמונה.png (668×801 px, 45 KB)

Both things happen because the page's UI language is Hebrew, and all the input boxes are adapted to RTL by default, even though English is LTR.

What should have happened instead?:

  1. The chip with the alias in English must appear as "n1".
  2. The English text in the chip must not be too close to the edge.
  3. The punctuation must appear on the correct end of the text.
  4. Text in LTR languages must be aligned to the left and text in RTL languages must be aligned to the right, no matter what the UI language is.

(Also mentioning the Codex, because some of the issues may be there. I suspect that most of the fixes must be in Wikifunctions code, but I might be wrong.)

Event Timeline

Change #1111620 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] FunctionEditor: add dir and lang ttributes to individual function editor inputs based on the language of the current block

https://gerrit.wikimedia.org/r/1111620

Just wondering should all the aliases in the english block also be moved to the left?

Screenshot 2025-01-15 at 17.18.47.png (806×1 px, 95 KB)

Or is is sufficient that only the text is displayed correctly like this:

Screenshot 2025-01-15 at 17.18.56.png (938×1 px, 108 KB)

Just wondering should all the aliases in the english block also be moved to the left?

Screenshot 2025-01-15 at 17.18.47.png (806×1 px, 95 KB)

Or is is sufficient that only the text is displayed correctly like this:

Screenshot 2025-01-15 at 17.18.56.png (938×1 px, 108 KB)

It's better to align it completely to the left in left-to-right languages. Setting dir="ltr" there is supposed, in theory, to do this, but in practice, some more CSS tweaks may be needed.

DSantamaria changed the task status from Open to In Progress.Jan 31 2025, 11:23 AM

Change #1111620 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] FunctionEditor: add dir and lang attributes to individual function editor inputs based on the language of the current block

https://gerrit.wikimedia.org/r/1111620

Updated screenshot, as of 2025-02-13:

image.png (1×1 px, 146 KB)

The chip with the alias "n!" appears as "!n".

This is still broken, and the text input for the chip control is still RTL. Does this need a fix in Codex?

In every chip, the end of every English string is too close to the chip's right edge.

This is now fixed.

The name appears as "!factorial". (I'd love to give you an example of a function name that actually includes punctuation for easy testing of LTR/RTL issues, but I couldn't find such a function. It may get created some day...)

This is now fixed.

The text in all the input boxes, as well as the chips, are all aligned to the right.

This is fixed for the input boxes; as the chip text input is RTL (see item 1), so the chips are still aligned to the right.

Not sure what to do with the task at this point.

Nice progress!

Yes, the chips have to be fixed. Each chip definitely has to get the correct lang and dir attributes. As for the general direction of the input box in which the chips appear, I'd say that it should get the lang and dir attributes of the specific language, although it's a bit less important.

In addition, the correct lang and dir attributes also have to be applied to the form fields that are added to the page after pressing "Add language" at the bottom of the page. Their values cannot be known initially, but they can be set after selecting the language in the first field. Currently, no lang and dir attributes are set there at all and the current UI language is applied in practice.

@Jdforrester-WMF We're exploring what we can do on the Codex side to address the remaining issues in T383788.