Problem/Motivation

When in behavior perspective we still have the Add paragraph buttons. This makes the behavior form less obvious and harder to find.

Proposed resolution

Hide Add paragraph buttons too.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#31 2882783-hide-add-paragraph-31.patch5 KBBerdir
#29 2882783-hide-add-paragraph-29-interdiff.txt929 bytessasanikolic
#29 2882783-hide-add-paragraph-29.patch5 KBsasanikolic
#27 2882783-hide-add-paragraph-27-interdiff.txt893 bytessasanikolic
#27 2882783-hide-add-paragraph-27.patch4.09 KBsasanikolic
#25 2882783-hide-add-paragraph-25.patch3.53 KBsasanikolic
#23 2882783-hide-add-paragraph-23-interdiff.txt2.66 KBsasanikolic
#23 2882783-hide-add-paragraph-23.patch4.05 KBsasanikolic
#20 2882783-hide-add-paragraph-20.patch3.51 KBsasanikolic
#17 hide_add_paragraph-2882783-17-interdiff.txt1.18 KBsasanikolic
#17 hide_add_paragraph-2882783-17.patch3.78 KBsasanikolic
#14 hide_add_paragraph-2882783-14-interdiff.txt1.11 KBsasanikolic
#14 hide_add_paragraph-2882783-14.patch3.47 KBsasanikolic
#5 perspective_tabs_hide_add_button.png73.2 KBtoncic
#5 hide_add_paragraph-2882783-5.patch3.18 KBtoncic
#10 hide_add_paragraph-2882783-10.patch3.16 KBBerdir
#11 hide_add_paragraph-2882783-11-test-only.patch1.23 KBBerdir
#11 hide_add_paragraph-2882783-11.patch3.26 KBBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Primsi created an issue. See original summary.

Primsi’s picture

Status: Active » Postponed (maintainer needs more info)
Primsi’s picture

Status: Postponed (maintainer needs more info) » Postponed
toncic’s picture

Assigned: Unassigned » toncic
Status: Postponed » Active
toncic’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
3.18 KB
73.2 KB

Changed .js a little bit, uploading screenshot.

miro_dietiker’s picture

Status: Needs review » Needs work

If we define this as favorised, then we need to test cover it.

toncic’s picture

Status: Needs work » Postponed
miro_dietiker’s picture

Status: Postponed » Active
Related issues: +#2901995: Scroll to the right position after edit / collapse

The other issue was fixed long ago... :-)

With variable length, the related issue about scrolling is even more important.

Berdir’s picture

Assigned: toncic » Berdir
Status: Active » Needs review
Issue tags: +Needs tests

Reroll, cleaner approach for adding the class and better class name.

Will look at tests.

Berdir’s picture

Berdir’s picture

Here are tests and removed the changes from the old widget, that doesn't have behaviors, no point in changing that.

The last submitted patch, 11: hide_add_paragraph-2882783-11-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

miro_dietiker’s picture

Status: Needs review » Needs work
Related issues: +#2825581: [META] Introduce a sticky header

I tested it with default Paragraphs install based on Paragraphs Collection (with Dropbutton as add mode) and it didn't work.

In fact this is the problem:

    if (count($options) > 1 && $add_mode == 'dropdown') {
      $add_more_elements = $this->buildDropbutton($add_more_elements);

The additional attribute added before is then overwritten.

Also as discussed, this works very well with the collapse all mode and the patch for sticky perspective tabs... Then switching the tabs leads to persistent scroll position as nothing above the viewport changes in height. But as soon as container like items above the viewport are expanded, the scroll position is messed up and you loose orientation. And now it's even harder to identify the item again.

Autocollapse is an optional thing, so this would be a UX degradation for most users IMHO if we get the sticky perspective tabs without scroll preservation.

The problem is also: If we would output the Paragraph summary on the behavior tab, it is likely outdated (or even empty for a just added Paragraph).

I would vote for this sequence:
- #2825581: [META] Introduce a sticky header
- #2901995: Scroll to the right position after edit / collapse
- (this issue) #2882783: Hide add paragraph buttons when viewing behaviors perspective

sasanikolic’s picture

The class should be added to the button now, and properly hidden on the behavior tab.

I am wondering, why don't we hide and show these things with css?

   if ($parWidget.find('#content').hasClass('is-active')) {
        $parWidget.find('.layout-region-node-main').addClass('content-active');
        $parWidget.find('.paragraphs-content').show();
        $parWidget.find('.paragraphs-behavior').hide();
        $parWidget.find('.paragraphs-add-wrapper').show();
      }

      if ($parWidget.find('#behavior').hasClass('is-active')) {
        $parWidget.find('.layout-region-node-main').addClass('behavior-active');
        $parWidget.find('.paragraphs-content').hide();
        $parWidget.find('.paragraphs-behavior').show();
        $parWidget.find('.paragraphs-add-wrapper').hide();
      }
sasanikolic’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 14: hide_add_paragraph-2882783-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

sasanikolic’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: hide_add_paragraph-2882783-17.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

This patch should apply.

sasanikolic’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 20: 2882783-hide-add-paragraph-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

Added some improvements and code fixes.

Status: Needs review » Needs work

The last submitted patch, 23: 2882783-hide-add-paragraph-23.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

Status: Needs work » Needs review
FileSize
3.53 KB

Rerolled again.

Status: Needs review » Needs work

The last submitted patch, 25: 2882783-hide-add-paragraph-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

I missed the button wrapper for the case when there is only one paragraph to add. This should make the test pass.

Status: Needs review » Needs work

The last submitted patch, 27: 2882783-hide-add-paragraph-27.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

sasanikolic’s picture

This should fix the failing test.

Berdir’s picture

Berdir’s picture

Berdir’s picture

Status: Needs review » Fixed

Committed!

  • Berdir committed 45d1d15 on 8.x-1.x
    Issue #2882783 by sasanikolic, Berdir, toncic: Hide add paragraph...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.