Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#52015 closed enhancement (reported-upstream)

Provide an ID for the author selector on the Block Editor

Reported by: molongui's profile Molongui Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.6
Component: Editor Keywords:
Focuses: Cc:

Description

Since WP 5.6 the author selector under the Status & visibility panel in the sidebar of the Block Editor have no HTML ID, so there is no trivial way to target it with a CSS rule. Neither with javascript.

My request to WP core developers is to provide either an ID or a CSS class to the component row of that field. Other fields in that same panel have an additional class, like the Visibility (.edit-post-post-visibility) or Publish (.edit-post-post-schedule) fields.

Looking into the source code, I guess it would be as easy as editing the wp-includes/js/dist/edit-post.js file to change this piece of code:

function PostAuthor() {
  return Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostAuthorCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelRow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostAuthor"], null)));
}

to something like this:

function PostAuthor() {
  return Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostAuthorCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelRow"], { className: "edit-post-post-author" }, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostAuthor"], null)));
}

Thanks!

Change History (3)

#1 @johnbillion
5 years ago

Thanks for the report. This is a wider problem in the block editor in general, none of the component rows in the sidebar include distinct class or id attributes.

I think this needs to be reported upstream on the Gutenberg repo.

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.


4 years ago

#3 @poena
4 years ago

  • Focuses coding-standards removed
  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Hi!
This has been reported upstream in the Gutenberg GitHub repository, and work can continue on this issue:
https://github.com/WordPress/gutenberg/issues/12067

Note: See TracTickets for help on using tickets.