Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
285 stars 76 forks source link

Emit `calciteStepperItemChange` when navigating by stepper methods #5021

Closed nwhittaker closed 4 months ago

nwhittaker commented 2 years ago

Description

When a user clicks a button that invokes a stepper method and navigates a stepper, the stepper should emit a calciteStepperItemChange events.

Acceptance Criteria

A stepper emits a calciteStepperItemChange whenever the step changes either by clicking a stepper-item heading or via a stepper method.

Relevant Info

No response

Which Component

calcite-stepper

Example Use Case

In some cases, it's necessary to force a user to visit steps in order. This can currently be accomplished by disabling subsequent steps and offering a button that, when clicked, enables the next step and navigates to it via the stepper's nextStep() method.

In order to cleanly track the current step and which steps have been visited (regardless if the user clicked the button or navigated to a previously enabled step by clicking its heading), it'd be helpful to unify that code in a single calciteStepperItemChange handler.

Another use case is the event provides an indicator that the step is rendered and ready for any setup work (e.g. setting initial focus).

jcfranco commented 2 years ago

We only emit change events on user interaction, so any code calling the stepper methods needs to sync up accordingly. Reason being that the code calling the stepper methods knows that there is potentially a change in step, hence why we don't emit. It also helps avoid cases where we can't distinguish where a change event came from.

I think what's missing is a property to easily know the selected stepper item. FYI, I'll have a PR for cleaning up event payloads this week that will introduce this prop.

macandcheese commented 10 months ago

Some items here as follow up from triage:

github-actions[bot] commented 4 months ago

Installed and assigned for verification.

jcfranco commented 4 months ago

Installed and assigned for verification.

False alarm. Updated the label on the wrong issue. 😅

nothing-to-see

jcfranco commented 4 months ago

Spike summary:

github-actions[bot] commented 4 months ago

cc @geospatialem, @brittneytewks

jcfranco commented 4 months ago

Added to this milestone per ☝️.

jcfranco commented 4 months ago

Closing in favor of https://github.com/Esri/calcite-design-system/issues/2094 as title and description are closer to the changes #9351 will include. cc @geospatialem