Skip to content

Redesign: surveys & forms#9504

Merged
ahukkanen merged 65 commits intodevelopfrom
feature/redesign-surveys
Aug 29, 2022
Merged

Redesign: surveys & forms#9504
ahukkanen merged 65 commits intodevelopfrom
feature/redesign-surveys

Conversation

@Crashillo
Copy link
Copy Markdown
Contributor

@Crashillo Crashillo commented Jul 1, 2022

🎩 What? Why?

Redesign surveys and forms. Use yield clauses in order to chunk the css assets.

Considerations

New NPM library included

📷 Screenshots

♥️ Thank you!

@Crashillo Crashillo added the project: redesign Barcelona City Council contract label Jul 1, 2022
@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch 2 times, most recently from fbaed76 to 6f946c6 Compare July 7, 2022 19:21
@Crashillo Crashillo force-pushed the feature/redesign-surveys branch from 6f946c6 to 0aa4997 Compare July 19, 2022 14:24
@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch from b3cac73 to a2938fd Compare July 21, 2022 10:14
@Crashillo
Copy link
Copy Markdown
Contributor Author

I've included an accessible library, called drag-on-drop, which is actually a wrapper of dragula. The main non-jQuery drag'n'drop libraries I found out, weren't accessibles.

@Crashillo Crashillo marked this pull request as ready for review July 26, 2022 15:03
@Crashillo Crashillo requested a review from rober-gd July 26, 2022 15:30
@rober-gd
Copy link
Copy Markdown

rober-gd commented Jul 27, 2022

All possible options

  • Align vertically block number, fieldset title and remaining character label

surveys_align

  • Maintain the height (and border radius if possible) of the text input when it takes focus or error status
input_focus.mp4
  • Style the file uploader button

design_file_uploader

  • When clicking on the "Upload file / Add file" button, a modal should open (just like the actual behavior)

survey_file_modal

@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch from dbe9329 to 6d2879d Compare July 27, 2022 14:26
@Crashillo
Copy link
Copy Markdown
Contributor Author

When clicking on the "Upload file / Add file" button, a modal should open (just like the actual behavior)

I'll come back to this modal-related stuff later on. Still pending to implement as component, that feature is pointed here

@Crashillo
Copy link
Copy Markdown
Contributor Author

Maintain the height (and border radius if possible) of the text input when it takes focus or error status

The error status is mislocated. The goal is to place it like that:
imagen

buuuuuuuut, the script who handles that is actually located in this PR. So, I'll fix it there 🤯

@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch 2 times, most recently from 2ffa360 to ca26631 Compare July 29, 2022 14:24
@rober-gd
Copy link
Copy Markdown

@Crashillo Here's the proto with the read-only version of the survey for non-logged users

@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch from 59b536e to 438db3c Compare July 29, 2022 17:03
@Crashillo Crashillo requested a review from ahukkanen August 3, 2022 08:55
Copy link
Copy Markdown

@rober-gd rober-gd left a comment

Choose a reason for hiding this comment

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

Read-only

  • List should start with the number 1 instead of 0

start_1

@Crashillo
Copy link
Copy Markdown
Contributor Author

Crashillo commented Aug 3, 2022

List should start with the number 1 instead of 0

I need @entantoencuanto to solve that out. The index number is a property of a collection in rails. In the readonly forms, that collection includes the "blocks" (title & description, optional field) as a regular question. It's tracked in https://github.com/PopulateTools/issues/issues/1635

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

I've test driven this as well and I just left few general comments and then a couple of comments regarding the usability.

Overall it looks fine, not everything worked perfectly yet but I understand it's supposed to be that way at this point as mentioned in some of the previous comments above.

Comment thread decidim-core/app/helpers/decidim/decidim_form_helper.rb Outdated
Comment thread decidim-forms/app/cells/decidim/forms/step_navigation/show.erb Outdated
Comment thread decidim-forms/app/cells/decidim/forms/step_navigation/show.erb Outdated
@Crashillo Crashillo mentioned this pull request Aug 10, 2022
9 tasks
@Crashillo Crashillo requested a review from ahukkanen August 12, 2022 15:59
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Nice progress on this one too, previous comments were already addressed.

I still have a problem regarding the color contrast issues with the free text fields (both short and long). This is essentially the same comment that I left in the previous review but to emphasize my point, I've also added some WCAG resources to apply colors to the inputs that meet the WCAG criteria.

Could you still fix this issue?

Otherwise it seems good but there is one failing spec that still needs to be fixed:

$ cd decidim-meetings
$ bundle exec rspec spec/system/meeting_registrations_spec.rb -e "Meeting registrations when meeting registrations are enabled and has a registration form when the registration form has file question and file is invalid shows errors for invalid file"
...
  1) Meeting registrations when meeting registrations are enabled and has a registration form when the registration form has file question and file is invalid shows errors for invalid file
     Failure/Error: expect(page).to have_content("Needs to be reattached")
       expected to find text "Needs to be reattached" in "..."
...

id: "#{choice_id}_matrix_row",
disabled: true %>
<% if answer_option.free_text %>
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The free text color contrast still does not seem quite right, although it is slightly better than last time:
Color contrast

When the input is enabled, the border color against the white background is #d0d3d8 which does not meet the minimum color contrast requirement of 3:1
Color contrast border
https://webaim.org/resources/contrastchecker/?fcolor=D0D3D8&bcolor=FFFFFF

More information:
https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html

Input border color contrast requirements

The same requirement of 3:1 also applies between the input background color and the border color which is right now slightly worse than against the background:
Color contrast background
https://webaim.org/resources/contrastchecker/?fcolor=D0D3D8&bcolor=FAFBFC

I also think the enabled input fields have to be clearly distinguishable from the disabled state but meeting the WCAG criteria here should help improving this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also on mobile, I would add a min-width to the matrix questions' free text fields:
Mobile matrix free text

Right now it does not necessarily identify as a text element where the user can write something. Plus it may be hard to fill those fields as you can only see 1-2 characters at a time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[...] meet the WCAG criteria

Since our designer is off a couple of weeks, what about postpone this matter 'til then? I've already written it down in the pending issue. The solution is actually very simple, just editting the tailwind-config.js. In such way, we can move forward on this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes sure it is fine for me.

Do you want to look into the min-width before merging or add that to the pending issues list too?

The specs needs to be fixed before merging, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we're on it. Just pointing the WCAG issue. I presume we can make it along this morning

@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch from 77a5e3e to 9c59128 Compare August 18, 2022 19:13
@entantoencuanto
Copy link
Copy Markdown
Contributor

entantoencuanto commented Aug 18, 2022

List should start with the number 1 instead of 0

I need @entantoencuanto to solve that out. The index number is a property of a collection in rails. In the readonly forms, that collection includes the "blocks" (title & description, optional field) as a regular question. It's tracked in PopulateTools/issues#1635

Fixed the numeration of items in the read only view

I've also fixed the failing test in meetings by changing the selector used to check terms of service

@Crashillo Crashillo requested a review from ahukkanen August 19, 2022 15:55
@ahukkanen
Copy link
Copy Markdown
Contributor

@entantoencuanto There is a merge conflict in this PR after merging pages. Could you take a look please?

@entantoencuanto entantoencuanto force-pushed the feature/redesign-surveys branch from c505330 to 781e24d Compare August 25, 2022 08:55
@entantoencuanto
Copy link
Copy Markdown
Contributor

Conflicts resolved after rebasing

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

I think this is quite close already from being merged. I've left few more comments I noticed during the latest review round.

I have also reported few issues in the pending issues list at #9675 that I noticed while testing this. You can address these also or leave them in the pending issues list (won't be blockers merging this).

Comment thread decidim-forms/app/views/decidim/forms/questionnaires/show.html.erb Outdated
Comment thread decidim-core/app/views/decidim/devise/shared/_boxes.html.erb Outdated
Comment thread decidim-forms/app/views/decidim/forms/questionnaires/show.html.erb Outdated
@Crashillo Crashillo requested a review from ahukkanen August 29, 2022 11:57
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Great work on this one!

This is otherwise ready from my perspective but I noticed one more regression issue after making the login boxes fully clickable.

Comment thread decidim-core/app/views/decidim/devise/shared/_login_boxes.html.erb
@Crashillo Crashillo requested a review from ahukkanen August 29, 2022 16:01
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Great! Everything looks good for me.

This is just a general question and if it is an actual bug we can move it to the pending issues but I noticed that on mobile I cannot see the question numbers
Mobile question numbers

On larger screen sizes they appear under the border of the page although on some mid-sizes they are cut at the very corner of the screen:
Larger screen question numbers

Is this by design or is it a bug?

@Crashillo
Copy link
Copy Markdown
Contributor Author

Is this by design or is it a bug?

Bug. I switched the position of the number in mobile. 👍

@ahukkanen
Copy link
Copy Markdown
Contributor

Bug. I switched the position of the number in mobile.

Thanks. But I find the position on the right side confusing when we are in the left-to-right reading world.

How about adding it just as an inline-block in front of the question?
Number positioning on mobile

@Crashillo Crashillo requested a review from ahukkanen August 29, 2022 17:01
@ahukkanen ahukkanen merged commit 9c49826 into develop Aug 29, 2022
@ahukkanen ahukkanen deleted the feature/redesign-surveys branch August 29, 2022 18:57
entantoencuanto added a commit that referenced this pull request Aug 29, 2022
* develop:
  Redesign: surveys & forms (#9504)
entantoencuanto added a commit that referenced this pull request Aug 29, 2022
* develop:
  Redesign: surveys & forms (#9504)
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* setup for chunked styles

* show.erb chunked for easier manipulation

* short, long, multiple & single question templates

* button controls

* matrix tables

* renamed js class

* bottom decorator

* fix logic

* [skip ci] renamed js class

* input file in forms

* add note

* styling sorting question

* include dragon library

* update btn classes & disabled confirmation modal

* Fix linter

* Update tests

This commit removes stylesheets/decidim/surveys/surveys from lists to
check after the removal of its registration on surveys assets config

* move the number inside the label

* use common button style for file-type question

* fix i18n complaints

* Move REDESIGN_PENDING message

* Fix test with expected questionnaire title format

* Recover disabled attribute in submit button

* Enable confirm modal when redesign is disabled

* Fix announcement texts

* Update selector in tests

* Fix tests with expected questionnaire title format

* Don't authorize_participatory_space twice

* Use the position in which responses arrive when the response is of type sorting

* Pass all required values in sorting form

* Remove unused component

* Adapt sorting test

* Fix tests with expected questionnaire title format

* Fix selector in test

* Update test

* Adapt tests

* Hide sorting questionnaire tests which don't fit with redesign

* design readonly form

* fix i18n lint

* remove obsolete assert

* fix comments about surveys

* new color form border

* fix color inputs

* replace links for buttons in tests

* wrap input/textarea for adjust the form-error message

* expand input if they¡re char limited

* move login_boxes to an external css component

* responsive login boxes

* update tests

* set min-width in free text fields of matrix forms

* Update selector in test

* Calculate position of questions in readonly questionnaires using ids of items to be indexed

* Use a different template for title_and_description elements of read only questionnaire

* Recover original text displayed for title and description

* Fix cell test adding required option

* Fix test

* Add tests to check the answer idx attribute

* Remove extra space

* Fix selector in tests to avoid ambiguities

* set margin-bottom for surveys as others modules do

* glitches on forms

* refactor login_boxes

* add hover effect

* switch number position mobile

* adapt rtl

Co-authored-by: Eduardo Martinez Echevarria <eduardomech@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project: redesign Barcelona City Council contract

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants