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

feat: Add onClick optional property to ProgressStepper #2973

Merged
merged 19 commits into from
Jan 15, 2025

Conversation

leeeandroo
Copy link
Contributor

@leeeandroo leeeandroo commented Jan 13, 2025

feat: Add onClick optional property to ProgressStepper

Purpose of PR

PR Checklist

  • I have read the relevant readme.md file(s)
  • All commits follow our Git commit message convention
  • Tests are added/updated/not required
  • Tests are passing
  • Storybook stories are added/updated/not required
  • Usage notes are added/updated/not required
  • Has been tested based on Contentful's browser support
  • Doesn't contain any sensitive information

This comment was marked as off-topic.

Copy link

vercel bot commented Jan 13, 2025

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

Name Status Preview Updated (UTC)
forma-36 ✅ Ready (Inspect) Visit Preview Jan 15, 2025 1:31pm

Copy link

github-actions bot commented Jan 13, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
CommonJS 112.39 KB (0%) 2.3 s (0%) 1.2 s (-1.08% 🔽) 3.4 s
Module 110.99 KB (0%) 2.3 s (0%) 1.4 s (+6.06% 🔺) 3.6 s

@leeeandroo leeeandroo changed the title feat: Add onClick optironal propperty to ProgressStepper feat: Add onClick optional property to ProgressStepper Jan 13, 2025
Copy link
Contributor

@whitelisab whitelisab left a comment

Choose a reason for hiding this comment

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

Overall this approach looks great! ⭐ I added a comment about the impact of changing the step from a span to a button on the step styles (numbers and icons are no longer centered). I also think it would be great to add another example to the component documentation showing how to use this new onClick prop.

const isClickable = onClick && state !== 'disabled';

return isClickable ? (
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

When this is changed to a button element, it is now affecting the spacing of the numbers/icons within the step circle. When the stepStyle is number, the change is ever so slight, but the number is no longer centered:

Not clickable (span element) Clickable (button element)
Screenshot 2025-01-13 at 11 00 32 PM Screenshot 2025-01-13 at 11 00 26 PM

Also, when the component uses the icon stepStyle, the impact is more noticable:

Not clickable (span element) Clickable (button element)
Screenshot 2025-01-13 at 11 01 21 PM Screenshot 2025-01-13 at 11 01 11 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 checking @whitelisab !
I could not simulate the misalignment on that level you show in the screenshots. But I did some changes, could you please check it again? (And let me know how you saw it in this way, so next time I can check it properly)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Introducing the button requires updating the focus style when navigating with the keyboard.

focus-tab.mov

As you can see in the video, we don't see the step number focused state on steps with a dark blue border. All focusable elements across the Design System components use the tokens.glowPrimary style for their focus ring.

With that said, here are my suggestions:

  • for the step number, use the tokens.glowPrimary instead of the current dark blue color
  • for the label that becomes a button, use the Forma 36 Button component instead. You will inherit the right focus glow, it also ensures consistency with the use of actionable components across the app. It could be used with the small size and transparent variant, with additional custom styling to reduce its width/height, if necessary.

@damann do we also need to update the Figma component to introduce the onClick feature?

Copy link
Contributor Author

@leeeandroo leeeandroo Jan 14, 2025

Choose a reason for hiding this comment

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

Thank you for checking and the well explained suggestions @cf-remylenoir !

for the step number, use the tokens.glowPrimary instead of the current dark blue color

Done!

for the label that becomes a button, use the Forma 36 Button component instead. You will inherit the right focus glow, it also ensures consistency with the use of actionable components across the app. It could be used with the small size and transparent variant, with additional custom styling to reduce its width/height, if necessary.

I have changed the button to the f36 Button component, but I have also added the tabIndex as -1, so user will only navigate to the step number/icon. Let me know if you think it is OK

@leeeandroo leeeandroo requested review from damann and a team as code owners January 14, 2025 11:07
@leeeandroo leeeandroo requested review from whitelisab and a team January 14, 2025 11:10
@john-e
Copy link

john-e commented Jan 14, 2025

@leeeandroo I tried the chromatic generated storybook, I think the labels below the step number should also be clickable. What do you think?

@leeeandroo
Copy link
Contributor Author

@leeeandroo I tried the chromatic generated storybook, I think the labels below the step number should also be clickable. What do you think?

That's a good point @john-e , thanks for the suggestion. Added, please have a look again 🙏

Copy link
Collaborator

@cf-remylenoir cf-remylenoir left a comment

Choose a reason for hiding this comment

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

Looking good on my end 👍 Thank you for your contribution!

@leeeandroo leeeandroo merged commit 1d1a6c0 into main Jan 15, 2025
17 checks passed
@leeeandroo leeeandroo deleted the feat/optional-onclick-progress-stepper branch January 15, 2025 14:19
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.

4 participants