Skip to content

fix(s2): Make gradient buttons have an animated transition #7585

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

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

devongovett
Copy link
Member

@devongovett devongovett commented Jan 8, 2025

This enables animated transitions on gradient buttons in the hover state like the other variants. It works by using registered custom properties via the @property rule, which allows defining the syntax that variables should use (<color> in this case). Then, you can add these custom properties to transition-property and they'll animate. The linearGradient macro now generates these variable definitions on demand.

Unfortunately, due to yet another Safari bug the gradient must be on a separate element from the button itself otherwise it causes layout flickering (reproduction).

Also fixes the static color issue (closes #7574) by simply setting the color-scheme to light so it doesn't change in dark mode. I'd rather not add a bunch of new tokens to the theme if they are only going to be used here. Changed the angle to be corner to corner instead of a hard coded value as well (checked with design on that).

@LFDanLu LFDanLu added the release label Jan 8, 2025
@rspbot
Copy link

rspbot commented Jan 8, 2025

reidbarber
reidbarber previously approved these changes Jan 9, 2025
@yihuiliao
Copy link
Member

yihuiliao commented Jan 9, 2025

Are the gradient buttons supposed to retain their background when pending or should it go gray like the other buttons?

@devongovett
Copy link
Member Author

oops yeah, updated

@rspbot
Copy link

rspbot commented Jan 9, 2025

@rspbot
Copy link

rspbot commented Jan 9, 2025

## API Changes

react-aria-components

/react-aria-components:useFilter

-useFilter {
-  options?: Intl.CollatorOptions
-  returnVal: undefined
-}

@react-aria/overlays

/@react-aria/overlays:AriaPositionProps

 AriaPositionProps {
   arrowBoundaryOffset?: number = 0
   arrowSize?: number = 0
   boundaryElement?: Element = document.body
   containerPadding?: number = 12
   crossOffset?: number = 0
   isOpen?: boolean
   maxHeight?: number
   offset?: number = 0
-  onClose?: () => void | null
+  onClose?: () => void
   overlayRef: RefObject<Element | null>
   placement?: Placement = 'bottom'
   scrollRef?: RefObject<Element | null> = overlayRef
   shouldFlip?: boolean = true
   targetRef: RefObject<Element | null>
 }

@devongovett devongovett added this pull request to the merge queue Jan 9, 2025
Merged via the queue into main with commit 6e6ae21 Jan 9, 2025
30 checks passed
@devongovett devongovett deleted the gradient-button-transition branch January 9, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants