Problem/Motivation

There are some related issues (I found these: #2893737: Move meta details element from NodeForm to ContentEntityForm, #2893740: Allow the sidebar for the node form to be used on other entity forms as well) that suggest that the entity_meta sidebar on the node add/edit form should be re-usable.

Proposed resolution

Provide a new render element 'Accordion' that can replace node entity_meta and can be re-used elsewhere.

@todo

Remaining tasks

@todo

User interface changes

@todo
Expected: nothing.

API changes

New render element.

Data model changes

@todo

Release notes snippet

@todo

Comments

huzooka created an issue. See original summary.

volkerk’s picture

Assigned: Unassigned » volkerk

Working on it.

volkerk’s picture

Assigned: volkerk » Unassigned
Status: Active » Needs review
StatusFileSize
new7.19 KB

First throw at adding a accordion render element.

I used the same approach as vertical_tabs does, but was considering adding process and pre-render from RenderElement class directly, maybe someone could shed a light why it is done using that intermediary details element?

We should define which behaviors are supported, think a default open item or
controlled accordion (opening an item will close all the others).
Also handling open / closed state is not implemented yet.

Some feedback would be much appreciated.

Status: Needs review » Needs work

The last submitted patch, 3: 3056089.patch, failed testing. View results

andrewmacpherson’s picture

First, you're going to have to explain what "accordion list" means. I've encountered the word "accordion" used many designers and developers, who understood it to mean different things. In my experience, I always have to ask for clarification about the intended behaviour. What special difference does the "list" part make?

Adding a new render element probably doesn't qualify as minor.

andrewmacpherson’s picture

diff --git a/core/lib/Drupal/Core/Entity/ContentEntityForm.php b/core/lib/Drupal/Core/Entity/ContentEntityForm.php
index 75bde9fe35..aec4885714 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityForm.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityForm.php
@@ -108,7 +108,7 @@ public function form(array $form, FormStateInterface $form_state) {
       // Advanced tab must be the first, because other fields rely on that.
       if (!isset($form['advanced'])) {
         $form['advanced'] = [
-          '#type' => 'vertical_tabs',
+          '#type' => 'accordion',
           '#weight' => 99,
         ];
       }

This is out of scope, surely? The issue summary says the scope is to add a new render element type, but this changes an actual form.

The new render element type is called "accordion" here, not accordion list.

andrewmacpherson’s picture

Priority: Minor » Normal
lauriii’s picture

Title: Provide a new render element for accordion list » Provide a new render element for accordion
Issue summary: View changes

I agree with @andrewmacpherson that it should be called accordion, not accordion list.

lauriii’s picture

@andrewmacpherson Usually when we create new render elements or theme hooks its great if we can add at least one usage of that component into core. This way we can ensure that it at least works in the use case of node sidebar. Given that, in my opinion, making node form sidebar use accordion would be nice to include in the scope of this issue.

andrewmacpherson’s picture

Re. #8;

I agree with @andrewmacpherson that it should be called accordion, not accordion list.

I didn't actually say what it should be called. Rather, I was asking for clarification about what both terms mean.

I ask because in my experience accordion is used to mean various different things, and there's confusion around the expected usage and behaviour. When I'm told there's going to be an accordion, I always have to ask what sort of accordion they mean. Here are some of the assumptions that I've encountered before:

  1. A single collapsible disclosure grouping. Basically another name for the details element.
  2. A sequence of details elements.
  3. A sequence of details elements, with special styling to convey that these details elements are somehow related to each other. Usually this comes as a visual design detail, and it isn't clear how screen reader users are supposed to understand the relationship.
  4. A sequence of details, where any can be open/closed at a given time.
  5. Or, constraints about how many can be open at a given time: 0-1, 1 or more, exactly 1, etc..
  6. More than one can be open at once, but only if they are adjacent. (Bizarre IMO, but I've heard this described as the defining feature once.)
  7. A sequence of details, with additional keyboard behaviours so users can move focus from summary to summary, bypassing interactive content in an open details. The WAI-ARIA Authoring Practices includes this as an optional behaviour, but doesn't say what situations it is suitable for.
  8. A sequence of disclosure elements like details, but with an additional semantic that the clickable titles are headings (h1-h6) in the document. The WAI-ARIA Authoring Practices pattern does this.
  9. EDIT: sometimes accordion refers to a sequence of details elements, where any number can be open/closed, but the total space available must be shared between them. The jQueryUI accordion demos include this scenario.

So what is the new render element being proposed? What does it mean, and how does it behave?

The issue summary says it would replace the node entity meta, which is currently a details element nested inside a vertical tabs container. The Seven theme alters both of these to be plain containers. Is this proposing to remove vertical tabs fron the node module, or is it just for Seven's form alter?

AmandeepKaur’s picture

Issue tags: +VB_Drupal_Contrib_Aug

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

komalk’s picture

Status: Needs work » Needs review
StatusFileSize
new6.58 KB

Rerolled patch to 9.1.x.

Status: Needs review » Needs work

The last submitted patch, 14: 3056089-14.patch, failed testing. View results

komalk’s picture

Assigned: Unassigned » komalk
komalk’s picture

Assigned: komalk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new7.19 KB
new1.34 KB

Fixing test cases!

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

greg boggs’s picture

I believe, for this patch to be tested, support for this render element needs to be added to the field group module. This is the issue for that: https://www.drupal.org/project/field_group/issues/3244774, it looks like some more work is needed there to make this happen.

pooja saraah’s picture

StatusFileSize
new7.81 KB
new2.43 KB

Fixed failed commands on #17
Attached patch against Drupal 9.5.x

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.

Tagging for IS updates as there are some todo's to fill in.

Also tagging for tests.

Could this be a duplicate of #3062136: Create a details/summary FieldFormatter plugin for text fields. though?

smustgrave’s picture

Status: Needs review » Needs work

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.