atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

feat(components): Allow for passing ref to Button component

Open rjdestigter opened this issue 9 months ago • 0 comments

Motivations

Provides a way to reference the button and give it focus. In the video, after using the keyboard to open and close the Line Item pop up and menu, the button receives focus again.

This is currently achieved by wrapping in the button in a extra div and using ref.current.querySelector("button"). Being able to reference the button directly would be nicer.

https://github.com/GetJobber/atlantis/assets/14314519/057ae7fb-812a-4f97-b49d-feb959d77cf3

Added

Implemented the Button component using. forwardRef. I tried really hard to make it typesafer where depending on used props such as url and to the ref would be typed accordingly but the heavy use of XOR would require a complete refactor of the prop types to achieve this.


In Atlantis we use Github's built in pull request reviews.

image

rjdestigter avatar May 09 '24 20:05 rjdestigter