Skip to content

core/list-item block seems to exhibit peculiar behavior when querying attributes #61672

Open
@webaxones

Description

Description

In a typography correction plugin, I check keyboard input via subscribe and retrieve the attributes of the current block using getBlockAttributes(currentBlockId) to determine if it can be processed.

For a Paragraph block (as with other blocks of this type), we initially get a result with the content attribute, which returns the RichTextData class. However, this is immediately followed by a second result where the content attribute indeed holds the entered character. Furthermore, as typing continues, the content attribute updates with the correct string.
image

However, with a core/list-item block, the behavior differs for the first item compared to the subsequent items: for the first element of the list, with each character input, we consistently receive the RichTextData wrapper. Yet, starting from the second list item, the content attribute displays the entered content correctly.
image

The following image corresponds exactly to the previous one. Three characters entered on the first list item return RichTextData, while the same three characters entered on the second list item return the content.
image

My question is as follows: is it normal to have different results for each item in the list?

Thanks!

I allow myself to tag @ellatrix following @youknowriad suggestion :)
__

Step-by-step reproduction instructions

  1. Check typing with subscribe
  2. Get current block attributes with getBlockAttributes(currentBlockId) and display it in the console
  3. See the difference in results

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.5.3
Gutenberg plugin is not installed

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, No

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Block] ListAffects the List Block[Feature] Rich TextRelated to the Rich Text component that allows developers to render a contenteditable[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions