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

[SOL-1944] Submit Answer UI #86

Merged

Conversation

e-kolpakov
Copy link
Contributor

@e-kolpakov e-kolpakov commented Jul 27, 2016

Description: This PR introduces concept of attempts to DnDv2 and adds UI elements to submit an answer and display number of attempts.

JIRA: Part of SOL-1944

Discussions: Discovery document for DnDv2 assessment mode (relevant section: 2.2.3) - covers only UI part of it, click handlers and backend processing will be implemented as a separate PR.

Sandbox URLs:

Currently pinned to 5754ac6

Screenshots:

  1. Student view - can't submit as no items are placed

image

  1. Student view - can submit (+ hover over reset):

image

Note "Reset problem" and "Keyboard help" are reworked to look more like the upcoming CAPA Problem redesign and edx-pattern-library in general.

Testing instructions:

  1. Create/edit DnDv2; put it into assessment mode
  2. Set "Max attempts" to zero.
  3. Publish, open in LMS.
  4. Note that "Submit" button is displayed. Make sure problem is in its initial state (reset if needed). Submit button should be disabled. Attempts info should not be displayed.
  5. Put any item to correct zone. "Submit" button should become enabled.
  6. Return to Studio, set "Max attempts" to any positive integer. Publish.
  7. Return to LMS. Note attempts info is displayed. Should read "You have used 0 of <number_from_step_6> attempts."

Not implemented as part of this PR - expected behavior:

  1. "Submit" button do nothing.
  2. Used attempts are always zero.

Author concerns:

This PR copies some classes from edx-pattern-library into DnDv2 own css. Other options considered seems like a greater evil:

  • edx-pattern-library is only available in lms-main-v2.css in edX-platform, and that file is not added to courseware page
  • Including edx-pattern-library into DnDv2 is feasible, but problematic: needs converting css into sass/scss, installing edx-pattern-library as node module, build system or script and finally committing both source sass/scss and generated files. All in all - too much trouble (and definitely too much for this "feature" PR)

On the other hand, classes copied are more or less colocated, so when edx-pattern-library classes become available on courseware pages it should be sufficient to just drop their copied counterparts from DnDv2 css.

Reviewers

@openedx-webhooks
Copy link

Thanks for the pull request, @e-kolpakov! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request.

To automatically create an OSPR issue for this pull request, just visit this link: https://openedx-webhooks.herokuapp.com/github/process_pr?number=86&repo=edx-solutions%2Fxblock-drag-and-drop-v2

@e-kolpakov e-kolpakov changed the title Submit Answer UI [SOL-1944] Submit Answer UI Jul 27, 2016
@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch 2 times, most recently from 0d660d4 to 0450f4c Compare July 28, 2016 12:41
@e-kolpakov
Copy link
Contributor Author

e-kolpakov commented Jul 28, 2016

@mtyaka for some reason tests are extremely flaky - at least one parameterized_final_feedback_and_reset or zone align test fail, but not a single one failed two times in a row + everything passes locally. I don't expect to change anything, so please ignore the failing CI build. Meanwhile, I'll try to make it pass.

UPD: and just after I have said that, CI build finishes successfully. :)

display_name=_("Maximum number of attempts"),
help=_(
"Limits the number of attempts learner can use to complete the problem. "
"For unlimited attempts, set to zero. This setting have no effect in standard mode."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "have no effect" -> "has no effect"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this field and related studio edit functionality have already been implemented in #81, you should probably remove this code from this PR.

@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch 2 times, most recently from 2af17ff to a909bd8 Compare July 29, 2016 10:19
@mtyaka
Copy link
Contributor

mtyaka commented Jul 31, 2016

@e-kolpakov Thanks for the updates! FYI both #81 and #82 have been merged into master, so if you rebase you can remove the extra commits from this PR.

I have been testing this locally. The code looks good and it's working correctly. I only have a few suggestions regarding the styles of the buttons. (I am no UI expert, but these suggestions should make the styles closer to the CAPA styles from https://github.com/edx/edx-platform/pull/13052) :

  1. In the Studio, the buttons and the "attempts" text look really tiny (see screenshot).
  2. I think it would look better if the margin/padding between the submit button and the "You have used ..." text would be larger, closer to the screenshots from the CAPA PR. Same thing for "Keyboard Help"/"Reset" buttons - I would increase the padding between button text and the vertical line that divides the buttons.
  3. The vertical line between "Keyboard Help" and "Reset" could be a bit brighter. It looks brighter in CAPA PR. Also, if you look closely, the top and bottom of the line are not straight (they are affected by buttons round borders).
  4. I think it would work better if disabled "Reset" button didn't have a grey background (the text should be greyed out, but the background should remain white). I believe that's how it works in the linked CAPA PR. The grey background draws too much attention to the disabled "Reset" button.

Tiny buttons in the Studio:

screen shot 2016-07-31 at 19 45 51

Buttons in the LMS:

The sizes are good, but notice the issues outlined above:

  • the paddings could be increased
  • the "Reset" button should not have a grey background
  • the line between the right floated buttons is too dark and has rounded endings

screen shot 2016-07-31 at 20 17 08

@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch from a909bd8 to f822741 Compare August 1, 2016 10:03
@e-kolpakov
Copy link
Contributor Author

Rebased from a909bd8

@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch 2 times, most recently from 289df94 to ca3f822 Compare August 1, 2016 12:46
@e-kolpakov
Copy link
Contributor Author

@mtyaka I've addressed the issues you have outlined - please review one more time.

@mtyaka
Copy link
Contributor

mtyaka commented Aug 1, 2016

Thanks @e-kolpakov, it looks very nice!

👍

  • I tested to make sure the buttons work correctly and look pretty
  • I read through the code
  • Includes documentation (We will update the README (and our demo course) once assessment mode functionality is complete.)

@e-kolpakov
Copy link
Contributor Author

e-kolpakov commented Aug 1, 2016

@cahrens, @staubina, @cptvitamin, @sstack22 this PR is ready for your review.

@cahrens
Copy link

cahrens commented Aug 1, 2016

@alisan @chris-mike, look, they've copied our new button bar design! 💯

@cahrens
Copy link

cahrens commented Aug 1, 2016

The focus should go someplace sensible after "Reset" is pressed. For capa problems, focus will go back to the top of the problem (the "meta" section after the problem name). See https://openedx.atlassian.net/browse/TNL-4882

And I know Submit isn't working yet, but for that story you should think about where keyboard focus should go.

@cahrens
Copy link

cahrens commented Aug 1, 2016

I believe the number of attempts remaining should be linked to the Submit button through aria-describedby. @cptvitamin can confirm.

@cahrens
Copy link

cahrens commented Aug 1, 2016

In Studio the icons are italicized. You should be using spans for icons, not i tags. Also make sure to mark the icons as aria-hidden.

For examples, see http://ux.edx.org/design_elements/icons/.

image

h('button.modal-dismiss-button', gettext("OK"))
h('div.keyboard-help-dialog', [
h('div.modal-window-overlay'),
h('div.modal-window', {attributes: {role: 'dialog', 'aria-labelledby': 'modal-window-title'}}, [
Copy link

@cahrens cahrens Aug 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect aria-labelledby. Has to be an ID, not a class.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cahrens technically I've just moved this code around (so this is an issue with previous versions of the code), but I've fixed it anyway.

@e-kolpakov
Copy link
Contributor Author

@cahrens no, I was trying to explain that I was not able to do that :)

@e-kolpakov
Copy link
Contributor Author

@cahrens I've just updated the sandbox

@cahrens
Copy link

cahrens commented Aug 3, 2016

For focus after pressing Reset, it might be better to put the focus up on the problem description (so it is read again by the screen reader). @cptvitamin can advise on this detail in his review.

Also, as I mentioned above the number of attempts remaining should be linked to the Submit button through aria-describedby. Again, @cptvitamin can confirm.

@cahrens
Copy link

cahrens commented Aug 3, 2016

I still have a concern about the button bar on small devices-- when it wraps, the help and reset buttons should be left-aligned above Submit (to match the new capa behavior).

image

If you have trouble achieving this, check in with @alisan617.

@@ -202,7 +202,7 @@ function DragAndDropTemplates(configuration) {
h('div.modal-window-overlay'),
h('div.modal-window', {attributes: {role: 'dialog', 'aria-labelledby': 'modal-window-title'}}, [
h('div.modal-header', [
h('h2.modal-window-title', gettext('Keyboard Help'))
h('h2.modal-window-title#modal-window-title', gettext('Keyboard Help'))
Copy link

@cahrens cahrens Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused a non-unique ID when 2 problems are on the same page. It is very easy to look for these sort of issues using Chrome and the aXe developer tool plugin.

image

@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch 3 times, most recently from f1406ec to c3b0cca Compare August 3, 2016 10:52
@e-kolpakov
Copy link
Contributor Author

@cahrens

  • Focus on description after reset - I've tried to do that, but for some reason neither Chrome nor Firefox set focus on description section, and AFAIK screen reader does not read it. Maybe I'm doing something wrong (I haven't spent more than 15 minutes trying to achieve this), so I would wait for @cptvitamin comments on this.
  • Buttons bar on small screens - implemented (looked up in https://github.com/edx/edx-platform/pull/13052)
  • Other review notes - addressed

@staubina
Copy link
Contributor

staubina commented Aug 3, 2016

My issue was corrected in another PR
👍

@cahrens
Copy link

cahrens commented Aug 3, 2016

@e-kolpakov Can you update the sandbox? I'm still seeing the help and reset buttons be right-aligned on wrap.

@e-kolpakov
Copy link
Contributor Author

@cahrens sure - give me 15 minutes.

@e-kolpakov
Copy link
Contributor Author

@cahrens updated.

@cahrens
Copy link

cahrens commented Aug 3, 2016

I'm still seeing issues with wrapping.

image

@e-kolpakov
Copy link
Contributor Author

e-kolpakov commented Aug 4, 2016

@cahrens that's because I'm just copying WIP styles from CAPA problems redesign: https://github.com/edx/edx-platform/pull/13052#issuecomment-237292836 :)

I've fixed the problem, but there it is not ideal still - for some screen sizes and "Submit" button length, sidebar buttons will still be shown on the right:

image

I would suggest keeping this "good enough" solution (I believe it is good enough, but correct me if I'm wrong) and make it better when/if CAPA redesign yields a better approach.

I'm updating sandbox right now, so hopefully by the time you see this message it will be ready.

@e-kolpakov e-kolpakov force-pushed the ekolpakov/assessment-submit-ux branch from 343eb54 to 5754ac6 Compare August 4, 2016 10:13
@cahrens
Copy link

cahrens commented Aug 4, 2016

Nit: the Help/Reset buttons stay left-aligned for a time during the "wrapping" phase. See image below. Perhaps @alisan617 will come up with a better approach in the capa work, and then you guys can copy it then.

image

Update: Oh, and I just saw your comment about this! :)

@cahrens
Copy link

cahrens commented Aug 4, 2016

👍

@e-kolpakov
Copy link
Contributor Author

@cahrens Thank you!

@sstack22
Copy link

Sorry for not commenting sooner - 👍

@bradenmacdonald
Copy link
Contributor

bradenmacdonald commented Aug 10, 2016

Merging now. Thanks all!

Due to scheduling requirements, full a11y review of this work is being tracked separately as SOL-1978

Edit: Actually, will squash first.

[#SOL-1944] Review notes: responsiveness, ARIA attributes, focus after reset
@haikuginger haikuginger force-pushed the ekolpakov/assessment-submit-ux branch from 1037959 to dd94251 Compare August 10, 2016 17:29
@haikuginger haikuginger merged commit 630a8d7 into openedx:master Aug 10, 2016
@bradenmacdonald bradenmacdonald deleted the ekolpakov/assessment-submit-ux branch August 10, 2016 20:09
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

Successfully merging this pull request may close these issues.

8 participants