Skip to content

fix(accordion): expand/collapse through isOpen prop #775

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

IuriPires
Copy link
Contributor

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

It fixes #735

Fixes # (735)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change contains documentation update

Breaking changes

Please document the breaking changes if suitable.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@vercel
Copy link

vercel bot commented May 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2023 8:56am

@IuriPires
Copy link
Contributor Author

@rluders , I worked on this one but now I'm thinking: seems that Flowbite-React never wanted to expose isOpen and setOpen properties directly, based on what I saw in the code. Maybe this one can be treated as a feature instead of a bug? Up to discussion.

@IuriPires
Copy link
Contributor Author

Marked as bug and feature. @tulup-conner , what you think about this one?

Copy link
Collaborator

@tulup-conner tulup-conner left a comment

Choose a reason for hiding this comment

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

Please refer to the contributing guide. Specifically, you need to make sure your PR passes the CI before submitting for review. It looks like you are not using prettier or are with a custom config. In the future, simply running

yarn format && yarn lint && yarn test && yarn build

Before you submit your changes will save a lot of time.

The changes look good overall you just did some weird stuff with Sidebar for some reason that fails the formatting check. Just undo that and the other stuff I mentioned and we will test this out.

When the CI checks pass and you've made the aforementioned changes just set this to Ready for review or, if you can't do that (I'm not sure) feel free to mention me again and I will check it out

@@ -92,7 +92,6 @@ describe('Components / Accordion', () => {
render(
<>
<TestAccordion />
{/* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you run yarn lint to confirm this works? The comment is there for a reason - <button>s are only supposed to have role="button". This test should just be rewritten to make this ESLint warning not come up in the first place but, otherwise, you'll need to restore this line.

export type { SidebarCollapseProps } from './SidebarCollapse';
export type { SidebarCTAProps } from './SidebarCTA';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused if you have a custom prettier config somehow or have just made these changes of your own accord, but they fail yarn prettier so you need to revert them. I'm not sure why they were made anyway in a PR for the Accordion

@@ -1,4 +1,4 @@
import type { Meta, StoryFn } from '@storybook/react';
import type { Meta, Story } from '@storybook/react/types-6-0';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please restore this change, see storybookjs/storybook#14190

@@ -266,15 +265,31 @@ describe('Components / Accordion', () => {
expect(content()[1]).not.toBeVisible(); // content should not be visible
});
});

describe('Collapse/expand panel', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please just collapse this into a single test like

should collapse panel if isOpen and expand if not after a user toggle event

Instead of introducing a beforeEach here

@IuriPires
Copy link
Contributor Author

Thank you @tulup-conner and sorry for replying after so long. Was kinda busy during last weeks. I checked and you were right. I had some custom configs on my VSCode. I have also analysed every point you've mentioned.

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (470c359) 99.54% compared to head (35990cd) 99.54%.

❗ Current head 35990cd differs from pull request most recent head eae1d7c. Consider uploading reports for the commit eae1d7c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #775      +/-   ##
==========================================
- Coverage   99.54%   99.54%   -0.01%     
==========================================
  Files         129      129              
  Lines        6539     6538       -1     
  Branches      391      392       +1     
==========================================
- Hits         6509     6508       -1     
  Misses         30       30              
Impacted Files Coverage Δ
src/components/Accordion/Accordion.tsx 100.00% <100.00%> (ø)
src/components/Accordion/AccordionPanel.tsx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@IuriPires IuriPires requested a review from tulup-conner June 9, 2023 10:12
@IuriPires
Copy link
Contributor Author

@tulup-conner also sorry for bad commiting type. I will be more precise and I'll re-read again the contribution guide to give the best following the contribuition rules.

@IuriPires IuriPires marked this pull request as ready for review June 11, 2023 14:12
@rluders
Copy link
Collaborator

rluders commented Jun 11, 2023

@IuriPires could you please, instead merge the main use rebase instead? It is better for history tracking on git.

@IuriPires
Copy link
Contributor Author

@IuriPires could you please, instead merge the main use rebase instead? It is better for history tracking on git.

Done :)

@rluders
Copy link
Collaborator

rluders commented Jun 16, 2023

@IuriPires I think that it isn't actually working as expected, or there is something wrong, check it here: https://flowbite-react-3hzdjhhhs-themesberg.vercel.app/docs/components/accordion (ps: also the docs sidebar isn't working after the change)

@IuriPires
Copy link
Contributor Author

@IuriPires I think that it isn't actually working as expected, or there is something wrong, check it here: https://flowbite-react-3hzdjhhhs-themesberg.vercel.app/docs/components/accordion (ps: also the docs sidebar isn't working after the change)

Hi there @rluders , could you confirm a thing? Main isn't work on my local env. I'm currently using node v18.15.0 (not building/serving Storybook) could you confirm this please? I've checkout older branches and it worked fine.

This is main:
Captura de ecrã 2023-06-16, às 12 08 29

This is a 3 week old branch
Captura de ecrã 2023-06-16, às 12 16 11

@rluders
Copy link
Collaborator

rluders commented Jun 29, 2023

Sorry, @IuriPires just had time to reply to you now. So... Not sure what is happening. I'm using node v19.2.0 and I don't have any issues with the storybook.

@rluders
Copy link
Collaborator

rluders commented Jul 4, 2023

@IuriPires I think that this one just needs a rebase, right?

@rluders
Copy link
Collaborator

rluders commented Jul 4, 2023

@IuriPires I think that it isn't actually working as expected, or there is something wrong, check it here: https://flowbite-react-3hzdjhhhs-themesberg.vercel.app/docs/components/accordion (ps: also the docs sidebar isn't working after the change)

Or maybe not... 🤔

@rluders rluders changed the title fix: expand/collapse through isOpen prop fix(accordion): expand/collapse through isOpen prop Jul 16, 2023
@rluders rluders marked this pull request as draft July 18, 2023 17:11
@dima-kov
Copy link

any progress on this?

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.

<Accordion.Panel isOpen={true}> doesn't work also setOpen and isOpen doesn't work with props
4 participants