Moodle
  1. Moodle
  2. MDL-36033

Left align Numeric value fields in Calculated and Numeric questions, when in RTL mode

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.5, 2.3, 2.3.2
    • Fix Version/s: 2.3.3
    • Component/s: Questions, Themes
    • Labels:
    • Testing Instructions:
      Hide
      1. Add an RTL language package (Hebrew or Arabic or Farsi...) to Moodle (Home / ► Site administration / ► Language / ► Language packs)
      2. Switch to the RTL language you have installed by navigating to Moodle's Front-page and choosing it from the Language menu (or add "&lang=he" to the end of the URL you are currently using. If inside a course, set the RTL language from the course's setting)
      3. Navigate into a Course
      4. Click the "Question bank"
      5. Click "add a new question" to open the Question Chooser dialog
      6. Choose a new Calculated question
      7. Verify that all numeric value fields (reported above) in the first and last question setting pages are correctly aligned to the left
      Show
      Add an RTL language package (Hebrew or Arabic or Farsi...) to Moodle (Home / ► Site administration / ► Language / ► Language packs) Switch to the RTL language you have installed by navigating to Moodle's Front-page and choosing it from the Language menu (or add "&lang=he" to the end of the URL you are currently using. If inside a course, set the RTL language from the course's setting) Navigate into a Course Click the "Question bank" Click "add a new question" to open the Question Chooser dialog Choose a new Calculated question Verify that all numeric value fields (reported above) in the first and last question setting pages are correctly aligned to the left
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      WIP-MDL-36033-master
    • Rank:
      44795

      Description

      Left align Numeric value fields in Calculated & Numeric questions, when in RTL mode
      The following input fields should be left aligned:
      (for easy input of numerical values in RTL mode)

      First question's setting page

      1. answer
      2. unit
      3. multiplier

      Third question's setting page:

      1. calcmax
      2. calcmin
      3. number
      4. tolerance

      And on "Quiz edit" page

      1. "Points" input field

      And on any Question edit page:

      1. defaultmark

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          You patch does not make any sense to me. There is no question-type specific CSS for LTR languages. We just use the CSS that comes naturally from formslib.php. Therefore, surely you should be fixing this in the generic formslib-rtl code, and not here?

          Show
          Tim Hunt added a comment - You patch does not make any sense to me. There is no question-type specific CSS for LTR languages. We just use the CSS that comes naturally from formslib.php. Therefore, surely you should be fixing this in the generic formslib-rtl code, and not here?
          Hide
          Nadav Kavalerchik added a comment -

          You are partly correct. but you should experience this from an RTL user's perspective...
          when switching to RTL mode, you switch the entire flow of the layout (direction:rtl) and sometimes even switch alignment too (text-align:right). But this is not input friendly to RTL users, since they still have to "punch in" numbers on the keyboard from left to right. (Numbers are an exception to the RTL rule) so they are added to the number on the left side. which is mathematically wrong. same goes to formulas. and another difficulty is to edit it all
          One workaround is to delete the entire input field and type it from scratch. which is not always convenient.
          So any numeric input form fields should be left justified when in RTL mode. (Not just in the Calculated question)

          I am not sure I can add a CSS rule on the formslib level to the "text input form field" that will fix this issue, because it has no type validation (numeric, text, symbols, specific language...) with an adjacent class that is added to the text input form field, as far as I know.

          Anyways, That is a good idea. I was not aware of any formslib style files. Can you point it out for me. just in case.

          btw, this issue goes beyond numbers. I was "fixing" (left adjusting) textarea input fields on several setting pages that take only english text as input. which were right justified in RTL mode and were unusable for RTL users.

          Show
          Nadav Kavalerchik added a comment - You are partly correct. but you should experience this from an RTL user's perspective... when switching to RTL mode, you switch the entire flow of the layout (direction:rtl) and sometimes even switch alignment too (text-align:right). But this is not input friendly to RTL users, since they still have to "punch in" numbers on the keyboard from left to right. (Numbers are an exception to the RTL rule) so they are added to the number on the left side. which is mathematically wrong. same goes to formulas. and another difficulty is to edit it all One workaround is to delete the entire input field and type it from scratch. which is not always convenient. So any numeric input form fields should be left justified when in RTL mode. (Not just in the Calculated question) I am not sure I can add a CSS rule on the formslib level to the "text input form field" that will fix this issue, because it has no type validation (numeric, text, symbols, specific language...) with an adjacent class that is added to the text input form field, as far as I know. Anyways, That is a good idea. I was not aware of any formslib style files. Can you point it out for me. just in case. btw, this issue goes beyond numbers. I was "fixing" (left adjusting) textarea input fields on several setting pages that take only english text as input. which were right justified in RTL mode and were unusable for RTL users.
          Hide
          Tim Hunt added a comment -

          Ah! I see. These are numbers. Now I understand why you have to have specific rules for these fields. Thanks for explaining. +1 from me.

          Show
          Tim Hunt added a comment - Ah! I see. These are numbers. Now I understand why you have to have specific rules for these fields. Thanks for explaining. +1 from me.
          Hide
          Nadav Kavalerchik added a comment -

          Great!

          I found similar issues with the Numeric question type.
          I am adding it here too. (and not opening a new issue, is that OK?)

          Show
          Nadav Kavalerchik added a comment - Great! I found similar issues with the Numeric question type. I am adding it here too. (and not opening a new issue, is that OK?)
          Hide
          Tim Hunt added a comment -

          +1. Thanks Nadav. Submitting for integration now.

          Show
          Tim Hunt added a comment - +1. Thanks Nadav. Submitting for integration now.
          Hide
          Nadav Kavalerchik added a comment -

          Rebased on latest master (19-10-2012)

          Show
          Nadav Kavalerchik added a comment - Rebased on latest master (19-10-2012)
          Hide
          Dan Poltawski added a comment -

          Integrated to master and 23, thanks Nadav!

          Show
          Dan Poltawski added a comment - Integrated to master and 23, thanks Nadav!
          Hide
          Rossiani Wijaya added a comment -

          HI Nadav,

          Tested this issue and it works great.

          However previewing a calculate question on pop a new window, the 'marked out of' field still have right alignment (on question bank page, select preview for calculated question). Shouldn't it be left justify?

          Show
          Rossiani Wijaya added a comment - HI Nadav, Tested this issue and it works great. However previewing a calculate question on pop a new window, the 'marked out of' field still have right alignment (on question bank page, select preview for calculated question). Shouldn't it be left justify?
          Hide
          Nadav Kavalerchik added a comment -

          Rossiani, Can you please attach a screen capture of the 'marked out of' wrong alignment. (Since I can not see it)

          Show
          Nadav Kavalerchik added a comment - Rossiani, Can you please attach a screen capture of the 'marked out of' wrong alignment. (Since I can not see it)
          Hide
          Rossiani Wijaya added a comment -

          *attaching screenshot

          Show
          Rossiani Wijaya added a comment - *attaching screenshot
          Hide
          Nadav Kavalerchik added a comment -

          I see, thanks.

          Can you confirm the the 'default mark' in each question's setting page is correctly aligned?

          Show
          Nadav Kavalerchik added a comment - I see, thanks. Can you confirm the the 'default mark' in each question's setting page is correctly aligned?
          Hide
          Nadav Kavalerchik added a comment -

          I have just checkout this branch and i can not reproduce it. I am not sure exactly where you get this screen capture from
          Are you inside a quiz? or directly inside the question bank, viewing a question's setting page?

          Show
          Nadav Kavalerchik added a comment - I have just checkout this branch and i can not reproduce it. I am not sure exactly where you get this screen capture from Are you inside a quiz? or directly inside the question bank, viewing a question's setting page?
          Hide
          Nadav Kavalerchik added a comment -

          btw, this fix is related to : MDL-36070

          Show
          Nadav Kavalerchik added a comment - btw, this fix is related to : MDL-36070
          Hide
          Rossiani Wijaya added a comment -

          To replicate the screen capture:

          1. access the question bank within a course
          2. create calculated question if there's none available
          3. with the question bank page, there's an option to preview the question for each question.
          4. select the preview icon for the calculated question

          'marked out of' value is align to right.

          ps: it looks correct in the edit question page.

          attaching screen capture.

          Show
          Rossiani Wijaya added a comment - To replicate the screen capture: access the question bank within a course create calculated question if there's none available with the question bank page, there's an option to preview the question for each question. select the preview icon for the calculated question 'marked out of' value is align to right. ps: it looks correct in the edit question page. attaching screen capture.
          Hide
          Rossiani Wijaya added a comment -

          Hi Nadav,

          I'm going to pass this issue and create MDL-36304 to fix the 'marked out of' field in question preview.

          Tested this for 2.3 and master.

          It works as expected.

          Test passed.

          Show
          Rossiani Wijaya added a comment - Hi Nadav, I'm going to pass this issue and create MDL-36304 to fix the 'marked out of' field in question preview. Tested this for 2.3 and master. It works as expected. Test passed.
          Hide
          Nadav Kavalerchik added a comment -

          Found it! and fix that issue too. Thank you for pointing that out.
          And just now, pushed this fix into the above branches master and Moodle 2.3 stable.

          Please see if you can pull them and test it again?

          Show
          Nadav Kavalerchik added a comment - Found it! and fix that issue too. Thank you for pointing that out. And just now, pushed this fix into the above branches master and Moodle 2.3 stable. Please see if you can pull them and test it again?
          Hide
          Rossiani Wijaya added a comment -

          Hi Nadav,

          I think it would be better to post the fix in MDL-36304.

          Because this issue has been tested.

          I will notify the integrator regarding this.

          Thank you for the quick fix.

          Show
          Rossiani Wijaya added a comment - Hi Nadav, I think it would be better to post the fix in MDL-36304 . Because this issue has been tested. I will notify the integrator regarding this. Thank you for the quick fix.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          I've added:

          .path-question.dir-rtl input[name="maxmark"],
          

          @ MDL-36304, for fixing the "mark out of" integer field on preview.

          Thanks Rossiani & Nadav!

          Side note: Once one commit has been integrated, instead of amending it with changes, if more work is needed, the developer should be adding new commits on top. Mainly to avoid conflicts / break history. Only when the commit has been integrated. No problem amending anything before that.

          Show
          Eloy Lafuente (stronk7) added a comment - I've added: .path-question.dir-rtl input[name= "maxmark" ], @ MDL-36304 , for fixing the "mark out of" integer field on preview. Thanks Rossiani & Nadav! Side note: Once one commit has been integrated, instead of amending it with changes, if more work is needed, the developer should be adding new commits on top. Mainly to avoid conflicts / break history. Only when the commit has been integrated. No problem amending anything before that.
          Hide
          Nadav Kavalerchik added a comment -

          Cool. got it! (Eloy)
          Thanks Rossiani!

          Show
          Nadav Kavalerchik added a comment - Cool. got it! (Eloy) Thanks Rossiani!
          Hide
          Dan Poltawski added a comment -

          Hurray!

          You did it, congratulations! You have on Mojito credit to redeem after the release of Moodle 2.4

          Show
          Dan Poltawski added a comment - Hurray! You did it, congratulations! You have on Mojito credit to redeem after the release of Moodle 2.4

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: