-
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
Site Editor: Use site title as a link #61258
Conversation
Size Change: +239 B (+0.01%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
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.
I think this approach makes sense, but I would like to suggest three things.
- How about using the original icon instead? This matches the icon in the "View Site" menu:
- What do you think about adding transition effects?
1213c99ea616364a98a825545ae23084.mp4
- It seems to cause overflow when the site title is long.
trunk | This PR |
---|---|
![]() |
![]() |
Also, I think this change requires feedback on accessibility, so I'll ping @afercia.
I'd support this as a very simple plan forward.
One of the benefits of using the |
A part of me would also like to use the link.mov |
The same link within the WordPress admin bar does not use underline on hovers, I don't think we need to here.
I agree.
I'll check this out. I think it's because I'm using the component. |
b3dff02
to
5940de0
Compare
I added this in eff5075. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @jarekmorawski. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thanks for the update.
The overflow when the title is long has been resolved, but the glyph is pushed outside.
I would expect it to look like the following.
There may be a better way to write it, but I would like to suggest one approach to solving this problem.
diff --git a/packages/edit-site/src/components/site-hub/style.scss b/packages/edit-site/src/components/site-hub/style.scss
index 7b0c59d752..7d856e6f50 100644
--- a/packages/edit-site/src/components/site-hub/style.scss
+++ b/packages/edit-site/src/components/site-hub/style.scss
@@ -33,6 +33,8 @@
text-decoration: none;
white-space: nowrap;
text-overflow: ellipsis;
+ position: relative;
+ padding-right: $grid-unit-15;
&:hover,
&:focus,
@@ -44,8 +46,9 @@
&:focus::after,
&:active::after {
content: "↗";
+ position: absolute;
font-weight: 400;
- margin-left: $grid-unit-05;
+ right: 0;
}
}
Another concern is that the clickable area is narrower because it is a text link. What do you think about removing variant="link"
from this element and applying size="compact"
?
After:
eff5075
to
ec78813
Compare
@t-hamano good idea; works well: CleanShot.2024-05-30.at.08.55.41.mp4and here's with a very long site title: |
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.
Thanks for the update!
Is there a reason to use focus-visible
? Furthermore, since the title is a link, it will have a focus outline by default in Windows high contrast mode, so a fallback outline would be unnecessary.
Can't we simplify it to something like this?
&:focus {
// Push the shadow away from the title.
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $gray-900, 0 0 0 calc(2 * var(--wp-admin-border-width-focus)) var(--wp-admin-theme-color);
}
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.
There are a couple of feedback items from Aki worth addressing.
I would think it's unexpected to have the focus visible if it's not necessary, especially since it has already been interacted with. This aligns with user experience principles by ensuring that visual cues like focus outlines are only used when they add value to the interaction. |
Co-authored-by: Aki Hamano <[email protected]>
a19e806
to
3e43809
Compare
I noticed that when you click the site title, view the site in a new tab, and then go back to the tab with the site editor, the arrow/icon is still visible. Not sure if that's the intent, but I would expect that it would disappear after clicking it. See video: Screen.Recording.2024-05-30.at.4.25.02.PM.mov |
It's because the link was focused last. |
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.
I would think it's unexpected to have the focus visible if it's not necessary, especially since it has already been interacted with. This aligns with user experience principles by ensuring that visual cues like focus outlines are only used when they add value to the interaction.
Okay, let's ship this👍
I think this PR probably introduced a small regression/issue when navigating from "view" to "edit" mode (clicking the canvas). you can see the site title shrinking for some milliseconds. bug.movThat said, I'm working on a PR to simplify the hub (among other things) that solve this as a consequence of some refactoring I think (See #61579 ) but if for some reason my PR don't land, we'll have to fix this bug otherwise. |
* Try using site title as a link * Proper ellipsis * ensure ↗ renders on long site titles * focus tweaks * use unicode Unlinked contributors: jarekmorawski. Co-authored-by: richtabor <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: jasmussen <[email protected]> Co-authored-by: bgardner <[email protected]>
* Try using site title as a link * Proper ellipsis * ensure ↗ renders on long site titles * focus tweaks * use unicode Unlinked contributors: jarekmorawski. Co-authored-by: richtabor <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: jasmussen <[email protected]> Co-authored-by: bgardner <[email protected]>
What?
An alternative to #51852.
Testing Instructions
Screenshots or screencast
CleanShot.2024-05-30.at.08.55.41.mp4