-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Editor: Display empty option when post author is missing #64165
Conversation
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 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. |
currentAuthor = [ | ||
{ | ||
value: 0, | ||
label: '', |
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.
This matches how "Quick Edit" displays the missing author.
Size Change: +3.17 kB (+0.18%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
Thanks for the PR! I have confirmed that this PR has resolved the issue. One thing that bothers me is that since there is no text on the toggle button, it is difficult for users to know that there is a button there. For example, what do you think about adding something like
|
@t-hamano, I was also thinking about that. A better fallback might be more useful in both cases. @jameskoster, @jasmussen, what do you think? |
Thanks, @jasmussen! I'm also considering using "(No author)" as a fallback in dropdowns. Do you think an empty option better conveys meaning there? Screenshot |
My instinct is that (No author) works better than an empty field. |
@@ -16,7 +17,8 @@ import { useAuthorsQuery } from './hook'; | |||
|
|||
function PostAuthorToggle( { isOpen, onClick } ) { | |||
const { postAuthor } = useAuthorsQuery(); | |||
const authorName = postAuthor?.name || ''; | |||
const authorName = | |||
decodeEntities( postAuthor?.name ) || __( '(No author)' ); |
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 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.
What?
Fixes #64163.
PR updates
useAuthorsQuery
to include an empty option in the author list when a current post author is missing.Why?
It allows changing a missing post author when the dropdown only has one option (only one user remains on the site).
When
SelectControl
orCombobox
has only one option and doesn't match the provided value, it will be automatically selected, and the user can't trigger a change event.Testing Instructions
Testing Instructions for Keyboard
Same
Screenshots or screencast
Dropdown
Combobox