core/list-item block seems to exhibit peculiar behavior when querying attributes #61672
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.
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.
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.
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
- Check typing with
subscribe
- Get current block attributes with
getBlockAttributes(currentBlockId)
and display it in the console - 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