Autocomplete no longer supports overlapping triggers #61919
Labels
Needs Testing
Needs further testing to be confirmed.
[Package] Rich text
/packages/rich-text
[Status] Stale
Gives the original author opportunity to update before closing. Can be reopened as needed.
[Type] Bug
An existing feature does not function as intended
Description
We use autocomplete triggers that are overlapping, specifically
@
and@@
, each triggering different type of suggestions. After one of the recent WP updates this is no longer working.Issue is most likely related to refactor in #55301. That PR changed logic from finding first matching trigger on the list within distance of the cursor, to finding closest trigger to the cursor. If we take
@@hello
as an example, beginning of single@
will always be closest to the cursor and@@
trigger will always be ignored. The possible fix is to look at the index after trigger (trigger index + trigger length) rather than trigger index. in such case the index would be the same for both triggers and first of them would be used.Step-by-step reproduction instructions
@hello
and@@hello
Screenshots, screen recording, code snippet
Environment info
Not working in WP 6.5.3, was working in WP 6.4.3.
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
The text was updated successfully, but these errors were encountered: