-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add link element :hover
interactivity control to global styles UI
#41976
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Size Change: +225 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
This comment was marked as outdated.
This comment was marked as outdated.
This is amazingly simple, great job. |
Yes! But due to the way the overlapping is handled the text is offset too far. @scruffian Can you think of a way to avoid this without setting a matching negative margin on the text? |
On my proposal I suggested adding arrows in case there were more than 3 options: Something that occurred to me while testing your PR is whether it would make sense to indicate the selectors that have values set. Maybe we could increase the weight of the labels so users don't need to click on every tab to see if there's a color selected. |
1fc294c
to
20d7d0c
Compare
I love where this is going, but at the same time I feel like it's over-complicating some things. Another thing that troubles me - but is not related directly to this PR - is that color is not - and should never be - the only differentiator for link statuses. A link on hover can have a dashed outline for example, when it's active it can have a solid outline, when it's visited it's usually (but not always) the same as the default state and so on. Of course these things should be defined in the theme styles, however if we start adding colorpickers for all link statuses, then it's reasonable to assume that at some point in the (very) near future, we'll need to add more controls in link elements like selecting underline/outline/border/shadow/whatever for each link-status 🤔 |
Thanks for the thought provoking feedback @aristath 🙇♂️
I'm concerned about exposing I'm more than happy to reduce the prominence of other less utilised pseudo classes. The
Agreed. In Theme JSON you can add
For the time being we're looking to keep the scope of this PR pretty small. Once we're happy with with UI and UX we can then look to expand this to cover more properties and elements. |
20d7d0c
to
02c39d9
Compare
I think that with the arrow solution we could achieve something similar to what @aristath suggested without the need to introduce more elements to the UI. In my original proposal, I also suggested an alternative way of displaying the controls that is probably better than my original one. If we applied it here, we could also use the description to explain each property: Screen.Recording.2022-06-29.at.16.44.57.mov |
It looks like the following changes will cause this PR to increase in complexity:
Therefore we should consider going back to just supporting Any objections? |
@javierarce I really like the mockup and the way it hides the complexity until you actually need it. I'll look to ship this PR in a super simple form and circle back to implement the version you have envisaged. |
:hover
interactivity control to global styles UI
:hover
interactivity control to global styles UI:hover
interactivity control to global styles UI
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/screen-link-color.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Andrei Draganescu <[email protected]>
89ab25e
to
395f632
Compare
Let's get the tests green! |
What?
Building on foundation put in place in #41786, this PR adds UI to allow users to set interactivity states for the top level link element for:
focuswe decided to simply and handle:hover
only for now.activewe decided to simply and handle:hover
only for now.As
these arethis is currently the only value supported in the Theme JSON handler this is all we expose for now.Note: we deliberately simplified this initial implementation. See #41976 (comment) for context.
Why?
We should allow users to set global values for link interactivity.
How?
Following designs in #38277 (comment) this PR adds a tab panel and duplicates the existing color components inside of each tab but this time dynamically generating the values and handlers.
Note: this is currently all very hardcoded and not particularly DRY. However I think that is acceptable and we can refactor as and when we add more elements/states.
Testing Instructions
a
elements or their respective pseudo selectors.Screenshots or screencast
Screen.Capture.on.2022-06-29.at.16-41-33.mp4