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

Words count in the multi-selection inspector doesn't work with bound content #67610

Closed
2 of 6 tasks
afercia opened this issue Dec 5, 2024 · 7 comments · Fixed by #67624
Closed
2 of 6 tasks

Words count in the multi-selection inspector doesn't work with bound content #67610

afercia opened this issue Dec 5, 2024 · 7 comments · Fixed by #67624
Assignees
Labels
[Feature] Block bindings [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Dec 5, 2024

Description

When two or more blocks are selected, the block inspector shows the amount of selected blocks and the selected words count.

When one of more of the selected blocks content is bound to a source, the words count still counts the words in the original content (the block markup) while visually the rendered content comes from the bound source, which likely contains a different amount of words.

While i do understand why this occurs, from an user perspective this looks just broken and confusing. Here's a couple of example screenshots:

Image

I wonder whether the words count adds great value in the first place. To my understanding it is only used when there is a multi-block selection. Is this information actually useful for users?

If the prevalent opinion is to keep the word count, then I would say that it should either work correctly for bound content or it should be disabled when a block has bound content.

Cc @WordPress/gutenberg-design @artemiomorales

Step-by-step reproduction instructions

  • Have a bound source that provides a text string to be used for connected content attribute of a paragraph block. You can qui8cly add this to your theme's functions.php
add_action( 'init', 'test_block_bindings' );

function test_block_bindings() {
	register_meta(
		'post',
		'text_short',
		array(
			'show_in_rest'      => true,
			'single'            => true,
			'type'              => 'string',
			'sanitize_callback' => 'wp_strip_all_tags',
			'default'           => 'Text from the bound source',
		)
	);
}
  • Create a post with two paragraphs and add only one word to each paragraph.
  • Select the first Paragraph, and bount its content to the registered source from the block settings panel > Attributes.
  • Select both paragraphs.
  • Observe the block inspector shows the word count.
  • Observe the words count is 2 words.
  • Observe the visible selected words are more than two.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@afercia afercia added [Feature] Block bindings [Type] Bug An existing feature does not function as intended labels Dec 5, 2024
@jasmussen
Copy link
Contributor

What is the question that folks in the design ping can help with?

@afercia
Copy link
Contributor Author

afercia commented Dec 5, 2024

The question is:

I wonder whether the words count adds great value in the first place.

Why this feature in the first place? Why it has been designed only for the multi-selection inspector and what users need addresses?

@jasmussen
Copy link
Contributor

That seems like a question that could use broader feedback than just a sub-group assumed to have designed that particular aspect of the editor. CC: @WordPress/gutenberg-core

@afercia
Copy link
Contributor Author

afercia commented Dec 5, 2024

Isn't that what the design team is supposed to be responsible for? Designing features.

@Mamaduka
Copy link
Member

Mamaduka commented Dec 5, 2024

My two cents: Considering the number of changes it might require compared to the benefits of the feature, we might just remove it.

IIRC, this also doesn't count words from controlled blocks like sync patterns.

@t-hamano
Copy link
Contributor

t-hamano commented Dec 5, 2024

The prototype of this panel appears to have been added a very long time ago. See: #12050

@ntsekouras
Copy link
Contributor

I'll spin up a quick PR to remove it.

@ntsekouras ntsekouras self-assigned this Dec 5, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block bindings [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants