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

[Dropdown]: unable conditionally render a dropdown on button click #11102

Open
2 of 6 tasks
svlesiv opened this issue Dec 18, 2024 · 4 comments
Open
2 of 6 tasks

[Dropdown]: unable conditionally render a dropdown on button click #11102

svlesiv opened this issue Dec 18, 2024 · 4 comments
Assignees
Labels
1 - assigned Issues that are assigned to a sprint and a team member. ArcGIS Site Scan Issues logged by ArcGIS Site Scan team members. calcite-components Issues specific to the @esri/calcite-components package. docs Issues relating to documentation updates only. estimate - 1 Very small fix or change (potentially a single line), doesn't require updates to tests. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone p - low Issue is non core or affecting less that 10% of people using the library

Comments

@svlesiv
Copy link

svlesiv commented Dec 18, 2024

Check existing issues

Actual Behavior

To avoid loading dropdown content, we used an external trigger button that renders the dropdown only on a button click. It worked in v2.6.0, but starting from v2.7.0, it seems that clicking the external trigger button is treated as a click outside, causing the modal to close immediately.

Expected Behavior

The dropdown component would be displayed when clicking on a button (outside the dropdown) that changes the state of a variable to render the dropdown.

Screenshot 2024-12-18 at 12 52 22 PM

Reproduction Sample

https://codepen.io/svlesiv/pen/vEBxJgZ

Reproduction Steps

  1. Go to https://codepen.io/svlesiv/pen/vEBxJgZ codepen.
  2. Click on the External Trigger button.
  3. The dropdown will not be displayed for v2.7.0 - v2.13.2.

Reproduction Version

2.13.2

Relevant Info

No response

Regression?

2.6.0

Priority impact

impact - p1 - need for current milestone

Impact

Rendering a table with many dropdowns would again decrease the performance that was improved by https://github.com/ArcGIS/sitescan-manager/pull/7069 PR.

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/calcite-ui-icons
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Site Scan

@svlesiv svlesiv added 0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. labels Dec 18, 2024
@github-actions github-actions bot added ArcGIS Site Scan Issues logged by ArcGIS Site Scan team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone labels Dec 18, 2024
@geospatialem geospatialem added spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment. docs Issues relating to documentation updates only. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. and removed bug Bug reports for broken functionality. Issues should include a reproduction of the bug. spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment. labels Jan 6, 2025
@geospatialem
Copy link
Member

Calcite has now aligned the dropdown component to only support opening via the "trigger" slot. Adding the docs label to add context to the required "trigger" slot for users.

@svlesiv Could the use case support triggering the component through the "trigger" slot?

@geospatialem geospatialem added estimate - 1 Very small fix or change (potentially a single line), doesn't require updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. p - low Issue is non core or affecting less that 10% of people using the library and removed bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment. labels Jan 6, 2025
@svlesiv
Copy link
Author

svlesiv commented Jan 6, 2025

Unfortunately, we cannot use trigger slot for our use case.
Closing this issue because we found a workaround for it.

@svlesiv svlesiv closed this as completed Jan 6, 2025
@gpbmike
Copy link
Contributor

gpbmike commented Jan 7, 2025

Thanks for your help @geospatialem. Adding more context to the use case Svitlana is referring to.

We found that when rendering many dropdowns at once, there is a significant performance hit. By deferring dropdown rendering by triggering with an external (to the dropdown) button, we can mitigate the performance drop.

The trigger slot does not work for us as that requires rendering the dropdown. We must rely on the "open" property. However, the above comment about "only support opening via the "trigger" slot" would imply that the "open" property should be read-only and should not open the dropdown. Is that a bug?

The workaround Svitlana referred to is to stop the click event from propagating and being caught by the newly rendered and opened (via "open" property) dropdown.

@geospatialem
Copy link
Member

geospatialem commented Jan 7, 2025

The trigger slot does not work for us as that requires rendering the dropdown. We must rely on the "open" property. However, the above comment about "only support opening via the "trigger" slot" would imply that the "open" property should be read-only and should not open the dropdown. Is that a bug?

@gpbmike This is not a bug, while it may have worked previously the intent of the dropdown component is to leverage the "trigger" slot to display its contents. We will re-open the above to add more context to the component's intent and use for folks.

@geospatialem geospatialem reopened this Jan 7, 2025
@DitwanP DitwanP removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jan 13, 2025
@DitwanP DitwanP self-assigned this Jan 13, 2025
@DitwanP DitwanP removed the 0 - new New issues that need assignment. label Jan 13, 2025
@DitwanP DitwanP added the 1 - assigned Issues that are assigned to a sprint and a team member. label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - assigned Issues that are assigned to a sprint and a team member. ArcGIS Site Scan Issues logged by ArcGIS Site Scan team members. calcite-components Issues specific to the @esri/calcite-components package. docs Issues relating to documentation updates only. estimate - 1 Very small fix or change (potentially a single line), doesn't require updates to tests. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone p - low Issue is non core or affecting less that 10% of people using the library
Projects
None yet
Development

No branches or pull requests

4 participants