Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathQuill toolbar placement in a relatively positioned parent - bug when in an RTL course. #988

Closed
taniwallach opened this issue Jan 16, 2024 · 2 comments

Comments

@taniwallach
Copy link
Member

When an input box appears in a relatively placed element in an RTL course, the MathQuill toolbar placement is problematic.

See the sample problem file chain01.txt and the image below. All is OK when the course language is English, but with the course language as Hebrew the location blocks the input box.

mq_menu_placement_issue

Related to the code at https://github.com/openwebwork/pg/blob/daff8afd342f06d25feb87d4c00280980492e318/htdocs/js/MathQuill/mqeditor.js#L362C9-L362C23

@drgrice1 Could you help with this? It seems the JavaScript code will need to condition how it calculates placement for these cases depending on whether the primary document direction is LTR (default) or RTL.

From simple.conf:

$language = 'he-IL';
$perProblemLangAndDirSettingMode = 'auto:en:ltr';

where dropping the language line gets placement to work.


Note: The problem triggers a warning. Use of uninitialized value $html_attribs in concatenation (.) or string at line 1794 of [PG]/macros/core/PGbasicmacros.pl A fix is below. Eventually I'll get a PR in.


diff --git a/macros/core/PGbasicmacros.pl b/macros/core/PGbasicmacros.pl
index 793e7b0c..3aeb3b55 100644
--- a/macros/core/PGbasicmacros.pl
+++ b/macros/core/PGbasicmacros.pl
@@ -1773,7 +1773,7 @@ sub openDivSpan {
                return ();
        }
        my $option_ref = {};
-       my $html_attribs;
+       my $html_attribs = '';
        if (ref($_[0]) eq 'HASH') {
                $option_ref   = shift;
                $html_attribs = processDivSpanOptions($option_ref);


@drgrice1
Copy link
Member

The quick and easy solution is to add /*rtl:ignore*/ above line 104 of mqeditor.scss (before right: 10px). That will make the toolbar appear on the right side of the page just as it does for left-to-right languages.

drgrice1 added a commit to drgrice1/pg that referenced this issue Jan 16, 2024
…to-left languages.

Currenlty if the course language is set to he-IL and the
`$perProblemLangAndDirSettingMode` is set to `auto:en:ltr`, then the
computations for the toolbar position make the toolbar on the right but
way to wide.  This just makes the toolbar appear the same as for
left-to-right languages.  That is not strictly correct, but since the
toolbar is not currently translated, I am not sure much better can be
done at this point.

This addresses issue openwebwork#988.
@taniwallach
Copy link
Member Author

Will be resolved by #989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants