Closed jtrost closed 10 months ago
Confirmed. The component seems to be expecting a record
, which I think is a text selection start/end, and as such is closely coupled with the RichText component.
I don't know if the intention is that it should be used in conjunction with useRichText
, and as such the documentation needs updating, or that is can be used on its own and the component needs updating.
Noting that the error is in this code:
if ( isCollapsed( record ) ) {
textContent = getTextContent( slice( record, 0 ) );
}
Where record
is undefined. The record
value comes from the unstable component useRichText
.
Hey everyone! Thanks for reporting this. Potential update to the Autocomplete
README is in the works in #49965.
TL;DR - Autocomplete
is integrated with other packages/components in a way that don't make it the best fit for standalone usage. Instead, it is possible to filter the editor's available completers, much like @JordanPak describes above. And example is being added to the README in the pending PR.
Thanks for the clarification @chad1008
In case anyone is looking for a direct link to his reference, here it is. 😄
🤦 ...and thank you for saving us all from my copy/paste failure 😆
Is there an existing issue for this?
Have you tried deactivating all plugins except Gutenberg?
Have you tried replicating the bug using a default theme e.g. Twenty Twenty?
Description
The code in the Usage section of the Autocomplete component raises TypeError: e is undefined.
Here are all of the Wordpress packages I am using:
Step-by-step reproduction instructions
Paste the code snippet below into any block.
Expected Behavior
An autocomplete field appears and is usable.
Current Behavior
Screenshots or screen recording (optional)
No response
Code snippet (optional)
WordPress Information
Gutenberg Information
9.9
What browsers are you seeing the problem on?
Firefox, Chrome
Device Information
Desktop
Operating System Information
OS X 10.14.6