uiwjs / uiwjs/react-codemirror

Autocomplete menu closes when typing characters without accents for accented label or filterText

Open
#722 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
161
PR merge metrics
No merged PRs in 30d

Description

I'm using a custom completion source with filterText and label, and I want to support matches that are case-insensitive and accent-insensitive. For example, I have the following completion:

{
  label: '{ePossível}',
  filterText: 'epossivel',
  displayLabel: 'ePossível',
  type: 'string'
}

When I type:

  • epossível → ✅ matches
  • epossvel → ✅ matches
  • epossivel → ❌ the autocomplete menu disappears after typing the i

This happens even though filterText is set correctly. I suspect the issue lies in how validFor is used internally.


The completion menu should remain open as long as the text typed by the user matches the filterText or label, even if accent marks are missing or characters differ slightly (e.g. e vs é). In my case, epossivel should continue to match {ePossível} through filterText.


What I tried

  • I removed validFor → autocomplete doesn't appear at all.
  • I used validFor: /[\p{L}\p{N}_]+/u → still closes after typing i in epossivel.
  • I tried using a validFor function that normalizes both user input and filterText, but it seems the menu still disappears prematurely.

This issue only happens when trying to autocomplete accented labels from non-accented user input, which should match via filterText. It seems the internal logic closes the autocomplete menu when the input no longer matches the regex, even if the options still include a match after normalization.

Is there a recommended way to support accent-insensitive autocompletion?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the accent-insensitive completion case described in the issue, then trace how validFor and filterText are evaluated when the typed prefix changes. Check whether the behavior belongs in this React wrapper or in the underlying CodeMirror completion handling. Done means the menu stays open for epossivel and still matches the provided filterText.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
developer-experience, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.