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

[Tree-Item] expose iconClickHandler #6950

Open
nsulzberger opened this issue May 10, 2023 · 5 comments
Open

[Tree-Item] expose iconClickHandler #6950

nsulzberger opened this issue May 10, 2023 · 5 comments
Labels
0 - new New issues that need assignment. ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members c-tree Issues that pertain to the calcite-tree and related components enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.

Comments

@nsulzberger
Copy link

Description

It would be nice if we could listen to the clicks of a user on the expand/collapse icon of a calcite-tree-item.
There is already the iconClickHandler event, but it is not exposed to the users.

Acceptance Criteria

iconClickHandler is exposed

Relevant Info

No response

Which Component

Tree-Item

Example Use Case

We would like to store the state of the tree-items if they are expanded or collapsed, and if the user goes away and returns to the tree we would like to initialize it so the items are expanded where they were expanded before.

Priority impact

p3 - want for upcoming milestone

Esri team

ArcGIS Scene Viewer

@nsulzberger nsulzberger added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels May 10, 2023
@github-actions github-actions bot added p3 - want for upcoming milestone ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members labels May 10, 2023
@macandcheese
Copy link
Contributor

This makes sense. Maybe we could use expandToggled or other terminology for the public event since the internal iconClick isn't very descriptive and could refer to icons provided via prop, or slotted, etc.

@macandcheese macandcheese added the c-tree Issues that pertain to the calcite-tree and related components label Aug 9, 2023
@geospatialem geospatialem added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 3 A day or two of work, likely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels Apr 2, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Apr 3, 2024
@geospatialem geospatialem added impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone and removed p3 - want for upcoming milestone labels May 21, 2024
@driskull
Copy link
Member

I think the event name here would be calciteTreeItemToggle.

@driskull
Copy link
Member

I'm seeing a potential issue with implementing this as is.

  • Currently, the click handler for the icon could emit the event, however the arrow right/left keys are handled at the parent tree level.
  • Ideally, these keys should emit this event as well since its a user interaction.
  • The child expanded state is also being modified when an item is selected in some cases.
    if (
    shouldUpdateExpand &&
    ["multiple", "none", "single", "single-persist"].includes(this.selectionMode)
    ) {
    target.expanded = !target.expanded;
    }

@jcfranco @geospatialem should we have a followup refactoring issue to handle this?

  • I think the arrowleft/arrowright events should be moved to the tree-item so that events could be cancelled if necessary and to emit the calciteTreeItemToggle event.
  • I'm not sure why the selection event is modifying expanded state.
  • I guess we could create an internal method to emit the event when necessary?

@geospatialem geospatialem added the spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment. label Oct 21, 2024
@geospatialem
Copy link
Member

I'm seeing a potential issue with implementing this as is.

  • Currently, the click handler for the icon could emit the event, however the arrow right/left keys are handled at the parent tree level.
  • Ideally, these keys should emit this event as well since its a user interaction.
  • The child expanded state is also being modified when an item is selected in some cases.
    if (
    shouldUpdateExpand &&
    ["multiple", "none", "single", "single-persist"].includes(this.selectionMode)
    ) {
    target.expanded = !target.expanded;
    }

@jcfranco @geospatialem should we have a followup refactoring issue to handle this?

  • I think the arrowleft/arrowright events should be moved to the tree-item so that events could be cancelled if necessary and to emit the calciteTreeItemToggle event.
  • I'm not sure why the selection event is modifying expanded state.
  • I guess we could create an internal method to emit the event when necessary?

Adding a spike label to determine if the approach above can be pursued or an additional effort should be sought.

@macandcheese
Copy link
Contributor

Related: #8945

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members c-tree Issues that pertain to the calcite-tree and related components enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library spike Issues that need quick investigations for time estimations, prioritization, or a quick assessment.
Projects
None yet
Development

No branches or pull requests

4 participants