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

Anchor Positioning API #3137

Open
vibdev opened this issue Feb 19, 2025 · 0 comments
Open

Anchor Positioning API #3137

vibdev opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@vibdev
Copy link
Contributor

vibdev commented Feb 19, 2025

Some part of the CK styling system isn't going to be compatible with the incoming anchor positioning api.

Namely the helpers seem to automatically detect strings that start with -- and wrap them in a var()

Creating an anchor is straightforward. Apply the anchor-name property to the selected element, and assign it a unique identifier. This unique identifier must be prepended with a double dash, much like a CSS variable.

e.g.

 .anchor-button {
     anchor-name: --anchor-el;
 }

Bug Repro:
https://stackblitz.com/edit/canvas-kit-react-v12-starter-w7cqqu-fbcpu4wq?file=src%2FApp.tsx

the crux is

const anchorVars = createVars('anchor');
const anchorDefaults = anchorVars({ anchor: '--anchor-el' });
is equivalent to 
const anchorVars = createVars('anchor');
const anchorDefaults = anchorVars({ anchor: 'var(--anchor-el)' });

but in this case I don't want the var parts because --anchor-el is not a custom property

@vibdev vibdev added the bug Something isn't working label Feb 19, 2025
@jaclynjessup jaclynjessup moved this to 🆕 New in Canvas Kit Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant