glideapps / glide-data-grid

🚀 Glide Data Grid is a no compromise, outrageously react fast data grid with rich rendering, first class accessibility, and full TypeScript support.
https://grid.glideapps.com
MIT License
3.98k stars 288 forks source link

The cell does not enter edit mode if typing a non-English letter #955

Closed aurimasy closed 3 months ago

aurimasy commented 4 months ago

Steps to reproduce:

  1. Switch to a non-English language that has some different letters than English (e.g. Lithuanian, German, Russian, etc.).
  2. Open https://grid.glideapps.com/.
  3. Click once on any cell.
  4. Type any non-English letter with a keyboard (e.g. Lithuanian ž, German ö, or Russian ш). The cell does not enter edit mode. Typing the letters that are the same as English enters edit mode.

Tested in browsers: Google Chrome Version 125.0.6422.113 (Official Build) (64-bit) Firefox 126.0 (64-bit) OS: Windows 11 Pro 23H2 22631.3593

BrianHung commented 4 months ago

Logic for entering edit mode on type is here

https://github.com/glideapps/glide-data-grid/blob/5983dcabd2fb55b675009813709752008da6d424/packages/core/src/data-editor/data-editor.tsx#L3339-L3359

Right now, it checks if the key pressed is a printable character within the ASCII range from space ( ) to tilde (~).

BrianHung commented 4 months ago

Tell me if #959 works for you.

aurimasy commented 4 months ago

Thank you for your fast response. It looks like /[\p{L}\p{M}\p{N}]/ug.test(event.key) && works well with non-English letters in Lithuanian, Russian, German. But it misses other symbols such as +, -, !, etc. Maybe better to use /[\p{L}\p{M}\p{N}\p{P}\p{S}]/ug.test(event.key) && in that case?

BrianHung commented 3 months ago

What symbols are typically shared with the number keys?

The unicode for symbols seems pretty broad:

\p{S} or \p{Symbol}: math symbols, currency signs, dingbats, box-drawing characters, etc.
\p{Sm} or \p{Math_Symbol}: any mathematical symbol.
\p{Sc} or \p{Currency_Symbol}: any currency sign.
\p{Sk} or \p{Modifier_Symbol}: a combining character (mark) as a full character on its own.
\p{So} or \p{Other_Symbol}: various symbols that are not math symbols, currency signs, or combining
BrianHung commented 3 months ago

added symbols and punctation

aurimasy commented 3 months ago

What symbols are typically shared with the number keys?

The unicode for symbols seems pretty broad:

\p{S} or \p{Symbol}: math symbols, currency signs, dingbats, box-drawing characters, etc.
\p{Sm} or \p{Math_Symbol}: any mathematical symbol.
\p{Sc} or \p{Currency_Symbol}: any currency sign.
\p{Sk} or \p{Modifier_Symbol}: a combining character (mark) as a full character on its own.
\p{So} or \p{Other_Symbol}: various symbols that are not math symbols, currency signs, or combining

I am not sure if \p{Other_Symbol} is really useful, but it is included with \p{S} and this shouldn't be an issue. Anyway, /[\p{L}\p{M}\p{N}\p{S}\p{P}]/ug.test(event.key) && does all the work. :)