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

#1646 Panel accordions are not using the carbon standards #1648

Merged
merged 26 commits into from
Apr 22, 2024

Conversation

srikant-ch5
Copy link
Contributor

Fixes #1646

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@JesusGuerrero JesusGuerrero requested review from matthoward366 and removed request for JesusGuerrero December 18, 2023 19:41
@matthoward366
Copy link
Member

matthoward366 commented Dec 19, 2023

A few things

  1. Nested Twisty panels don't seem to be working.
    Screenshot 2023-12-19 at 11 11 10 AM
  2. Is there a reason we're closing open panels when a new panel opens? I think we can leave panels open now?
  3. When opening a panel it's kind of jerky and flickers. Do you also see this?
  4. When using selectors in tests like button.bx--accordion__heading are we able to define our own class instead? Ideally we'd keep most of the same classNames we had before. For example is it possible to use properties-category-title here?

@srikant-ch5
Copy link
Contributor Author

srikant-ch5 commented Dec 20, 2023

A few things

  1. Nested Twisty panels don't seem to be working.
    Screenshot 2023-12-19 at 11 11 10 AM
  1. Is there a reason we're closing open panels when a new panel opens? I think we can leave panels open now?
  • I have included this to replicate previous panel behaviour I will update PR to leave panels open as default accordion behaviour.
  1. When opening a panel it's kind of jerky and flickers. Do you also see this?
  • This issue can be resolved once we allow multiple panels to be opened.
  1. When using selectors in tests like button.bx--accordion__heading are we able to define our own class instead? Ideally we'd keep most of the same classNames we had before. For example is it possible to use properties-category-title here?
  • I will update this PR taking this into consideration.

@matthoward366
Copy link
Member

  1. We need to have 1 fixed before we can merge this PR. This would be a regression of the current behavior.

@srikant-ch5
Copy link
Contributor Author

srikant-ch5 commented Dec 21, 2023

  1. We need to have 1 fixed before we can merge this PR. This would be a regression of the current behavior.

Hi @matthoward366 Accordion Inside Accordion Issue is resolved.
I have replaced few classnames as they were before but for accordion button its same since its present at child level inside AccordionItem.

@matthoward366
Copy link
Member

Did you make the change for This issue can be resolved once we allow multiple panels to be opened.? I'm still only seeing 1 panel open at a time.

padding: $spacing-06 $spacing-05 $spacing-05;


.bx--accordion__item {
Copy link
Member

@matthoward366 matthoward366 Jan 3, 2024

Choose a reason for hiding this comment

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

Can you give some details as to why we need to set each of these? I took out most of these a didn't notice an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This spacing is to keep it consistent with Accordions included in twisty panel and also with previous layout

padding: $spacing-06 $spacing-05 $spacing-05;

Copy link
Member

Choose a reason for hiding this comment

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

This is fine but does this need to use the carbon class? Also, can you add a comment to why each of these carbon overrides are needed? For example why do we need to set transform: rotate(90deg);?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since Accordion inside Accordions are not supported in Carbon Components carbon-design-system/carbon#4768 (comment) I am handling collapsed and expanded state to hide/unhide the inner accordion content and rotate accordion arrow present beside the header using these carbon classes.

border-bottom: 0;
.properties-categories {
.bx--accordion__item {
margin: 3 -1rem; // Remove 16px outer padding for accordion title and content
Copy link
Member

Choose a reason for hiding this comment

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

I'm seeing this in the browser.

Screenshot 2024-01-03 at 4 10 49 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I have removed this in my latest commit.

@srikant-ch5
Copy link
Contributor Author

srikant-ch5 commented Jan 5, 2024

Did you make the change for This issue can be resolved once we allow multiple panels to be opened.? I'm still only seeing 1 panel open at a time.

HI @matthoward366 Now multiple panels can be opened at the same time and also can navigate to panels with alerts. Please review.

// Open Tab with Alert Message when from Alerts Tab or a open Default Tab
open={ this.defaultOpenTab === tab.group || this.alertOpenTab === tab.group }
onHeadingClick={this._showCategoryPanel.bind(this, tab.group)}
className={`bx--accordion__item-${i} ${classNames("properties-category-content",
Copy link
Member

Choose a reason for hiding this comment

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

Why are we using bx--accordion__item-${i} for a classname? This seems odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this classname now for the content.

padding: $spacing-06 $spacing-05 $spacing-05;


.bx--accordion__item {
Copy link
Member

Choose a reason for hiding this comment

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

This is fine but does this need to use the carbon class? Also, can you add a comment to why each of these carbon overrides are needed? For example why do we need to set transform: rotate(90deg);?

@srikant-ch5
Copy link
Contributor Author

Hi @nmgokhale @matthoward366 I have included Carbon 11 Accordions in this PR, please review and let me know in case of any changes. Thanks.

@@ -0,0 +1,1199 @@
{
"name": "canvas",
Copy link
Member

Choose a reason for hiding this comment

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

Delete package-lock.json file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @nmgokhale I have deleted package-lock.json file and updated the PR.

@nmgokhale
Copy link
Member

@srikant-ch5

  1. Comparing your PR against https://elyra-canvas-test-harness.u20youmx4sm.us-south.codeengine.appdomain.cloud/#/, there's a lot of spacing below category content. Compare the padding for properties-category-content class in your PR and test harness.
Screenshot 2024-04-17 at 3 50 10 PM
  1. Comparing properties accordion with panel accordion, there are some differences in CSS -
Screenshot 2024-04-17 at 3 50 54 PM
  1. In https://elyra-canvas-test-harness.u20youmx4sm.us-south.codeengine.appdomain.cloud/#/, only 1 category is open at a time whereas in your PR, I can open several categories. @matthoward366 Is this okay?
Screenshot 2024-04-17 at 3 54 14 PM

@srikant-ch5
Copy link
Contributor Author

srikant-ch5 commented Apr 18, 2024

Hi @nmgokhale

  1. I have adjusted spacing and padding to match with existing panels.
  2. I have adjusted height and border colour of accordionitems.
  3. As per our above conversation we are allowing multiple accordions to be open at once.
    Please review above changes.

}

// Remove Default borders for Accordions
.cds--accordion__item {
Copy link
Member

Choose a reason for hiding this comment

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

Replace cds--accordion__item with properties-category-content.

.cds--tabs__nav {
overflow-x: auto; // override carbon so scrollbar doesn't always show
.properties-categories {
.cds--accordion__item--active .cds--accordion__content {
Copy link
Member

@nmgokhale nmgokhale Apr 18, 2024

Choose a reason for hiding this comment

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

This should be .properties-category-content .cds--accordion__content

Adding .cds--accordion__item--active removes the CSS when multiple accordions are open.

}
}
}

.properties-category-title {
Copy link
Member

Choose a reason for hiding this comment

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

This class no longer exists in the code.

}

//Override default accordionitem height to match with previous panels
.cds--accordion__heading {
Copy link
Member

@nmgokhale nmgokhale Apr 18, 2024

Choose a reason for hiding this comment

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

You don't need this css. You can specify <Accordion size="lg"> in editor-form.jsx file and it will add height 48px.


// Remove default accordion padding
.cds--accordion__item--active .cds--accordion__wrapper {
padding-block-end: 0px;
Copy link
Member

@nmgokhale nmgokhale Apr 18, 2024

Choose a reason for hiding this comment

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

This is still adding some top padding. Change this to -

// Remove default accordion padding
	.properties-category-content .cds--accordion__wrapper {
		padding: 0;
	}

.properties-categories {
.cds--accordion__item--active .cds--accordion__content {
// 24px padding between accordion title and content (issue #3106)
padding: $spacing-02 $spacing-05 $spacing-05;
Copy link
Member

Choose a reason for hiding this comment

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

Remove the comment on line 85.
This padding doesn't look correct. In test harness, there's padding: $spacing-05 added -
Screenshot 2024-04-18 at 12 51 58 PM

@srikant-ch5
Copy link
Contributor Author

Hi @matthoward366 Could you please review Carbon 11 Accordion changes in this PR ?

Copy link
Member

@matthoward366 matthoward366 left a comment

Choose a reason for hiding this comment

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

Looks good

@matthoward366 matthoward366 merged commit e45ca41 into elyra-ai:main Apr 22, 2024
3 checks passed
@srikant-ch5 srikant-ch5 deleted the 14295_Accordion_RightFlyoutN branch June 7, 2024 05:36
matthoward366 pushed a commit to matthoward366/canvas that referenced this pull request Aug 5, 2024
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.

Panel accordions are not using the carbon standards
3 participants