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

feat(forms): Horizontal layout #18354

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ccailly
Copy link
Member

@ccailly ccailly commented Nov 20, 2024

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

Added the possibility of grouping up to 4 questions (or comments) in a horizontal layout.

Screenshots (if appropriate):

Capture.video.du.20-11-2024.14.15.52.webm

@ccailly ccailly self-assigned this Nov 20, 2024
@ccailly ccailly added the Forms label Nov 20, 2024
@ccailly ccailly added this to the 11.0.0 milestone Nov 20, 2024
@ccailly
Copy link
Member Author

ccailly commented Nov 20, 2024

Horizontal layout behavior on form rendering.

Capture.video.du.20-11-2024.16.24.18.webm

@ccailly ccailly marked this pull request as ready for review November 21, 2024 08:42
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

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

It seems impossible to drag a question between two horizontal layouts or at the top of the form if the first question use the horizontal layout:

image

@AdrienClairembault
Copy link
Contributor

When dragging a question from a horizontal row, it can't be added next to a a question that is not on a row:

image

It only work with questions that are not from a row (you can see the extra space that allow the question to be inserted):

image

@ccailly ccailly force-pushed the feature/form-horizontal-layout branch 4 times, most recently from d50d974 to 82ef5bf Compare December 9, 2024 09:30
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

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

Some UI suggestions, pinging @orthagh to confirm if he agrees with it.

form-split1

  1. I think the actions should be displayed when you hover on the empty blocks (rather than having to click inside of them to see the actions).

  2. Not sure about the button styling, it feels a bit strange with the "straight" border radius.
    IMO, just using a cursor:pointer for the active state would be enough and we wouldn't need to use the active button styling.

  3. The buttons are displayed in a muted style when inactive. It make them feel "disabled", I think displaying them at the normal opacity would be clearer.

form-split2

I can't move my question into the open slots, not sure if it is on purpose ?
Also each time I drop it, a slot disappears.

form-split3

Shouldn't deleting the second slot transform my field into a single row item since there is only one slot left ? The split row controls are still displayed here, it seems impossible to remove them.

form-split4

It seems questions are always moved to the first slot, even when inserted into a specific slot.

@orthagh
Copy link
Contributor

orthagh commented Dec 11, 2024

I think the actions should be displayed when you hover on the empty blocks (rather than having to click inside of them to see the actions).

Yes, but take into account a way to display them in responsive mode. We may have an active state in addition of hover.
Or just make behavior differ on both displays, hover on a big screen, active on mobile.

Shouldn't deleting the second slot transform my field into a single row item since there is only one slot left ? The split row controls are still displayed here, it seems impossible to remove them.

Agree

@ccailly ccailly force-pushed the feature/form-horizontal-layout branch from fada622 to 32bc6ca Compare December 23, 2024 15:11
@AdrienClairembault
Copy link
Contributor

Sometimes the drag and drop become very small (seems to happens randomly):

image

@AdrienClairembault
Copy link
Contributor

I think you already known this one but the "vertical" styles are not applied sometimes:

image

@ccailly
Copy link
Member Author

ccailly commented Jan 2, 2025

Sometimes the drag and drop become very small (seems to happens randomly):

image

I haven't been able to reproduce this bug, I've tried a lot of things but I never get this all-crushed display.

@AdrienClairembault
Copy link
Contributor

Maybe we should force the height to be identical for a single row ?

image

@ccailly ccailly force-pushed the feature/form-horizontal-layout branch from 8b95c12 to 29e0283 Compare January 6, 2025 14:05
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

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

It feels very nice and easy to use. I think we are good overall and can merge once the tests go green.
Do you want to do a final review on your side @orthagh ?

Note that there are probably a few minors issues that can still be found, but we can fix them later to avoid keeping this PR open too long.

@orthagh
Copy link
Contributor

orthagh commented Jan 7, 2025

I may want to make a final check yes.
Will try to do that this afternoon.

@orthagh
Copy link
Contributor

orthagh commented Jan 7, 2025

I found a few minor bugs related to this pr:

  • When a comment has been added in a slot and after selecting another slot, the vertical text is truncated. Note if you save and reload the form, the bug is not present anymore.
  • After deleting a question in a slot, the tooltip of the delete button remains. If you delete more, they are stacked and remain in the dom. It also makes this additional deletion harder because the remained tooltip is above the delete button.. Same, saving and reloading the page "fixes" the issue.
  • If the last deleted slot is a "comment", the layout container remains. It should be deleted as done for a "question"

More general bugs (probably affecting the main branch also):

  • There are cases where the control bar is displayed twice:
    image
  • The delete button of a comment container has no tooltip.

@trasher
Copy link
Contributor

trasher commented Jan 13, 2025

Please review sonar issues

@ccailly
Copy link
Member Author

ccailly commented Jan 13, 2025

Please review sonar issues

The issues reported by SonarQube don't seem to be related to my changes.
I've made changes to the Html.php file, but not to the method that's causing the problem.
I can look into it, but probably in another PR to avoid complicating this one.

@ccailly ccailly force-pushed the feature/form-horizontal-layout branch from 0ef68d5 to 0d1ede4 Compare January 13, 2025 15:41
@trasher
Copy link
Contributor

trasher commented Jan 14, 2025

Sonar issues are indeed now fixed (after you rebase). But now, database update is failing.

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

Successfully merging this pull request may close these issues.

4 participants