react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Fix cell focus stealing strategy

Open nstepien opened this issue 2 years ago • 5 comments

NVM we steal focus immediately on mousedown before we can focus on anything else it seems...

nstepien avatar Apr 07 '22 22:04 nstepien

Codecov Report

Merging #2886 (7ae65db) into main (3ead8b4) will increase coverage by 1.09%. The diff coverage is 100.00%.

:exclamation: Current head 7ae65db differs from pull request most recent head 4a63cb7. Consider uploading reports for the commit 4a63cb7 to get more accurate results

@@            Coverage Diff             @@
##             main    #2886      +/-   ##
==========================================
+ Coverage   92.96%   94.06%   +1.09%     
==========================================
  Files          39       38       -1     
  Lines        1251     1246       -5     
  Branches      405      397       -8     
==========================================
+ Hits         1163     1172       +9     
+ Misses         88       74      -14     
Impacted Files Coverage Δ
src/hooks/useRovingCellRef.ts 100.00% <100.00%> (ø)
src/hooks/useViewportColumns.ts 83.87% <0.00%> (-1.85%) :arrow_down:
src/hooks/useCalculatedColumns.ts 99.16% <0.00%> (-0.84%) :arrow_down:
src/utils/selectedCellUtils.ts 96.92% <0.00%> (-0.18%) :arrow_down:
src/DataGrid.tsx 90.00% <0.00%> (-0.16%) :arrow_down:
src/Row.tsx 100.00% <0.00%> (ø)
src/Cell.tsx 91.30% <0.00%> (ø)
src/Columns.tsx 100.00% <0.00%> (ø)
src/EditCell.tsx 100.00% <0.00%> (ø)
src/GroupRow.tsx 100.00% <0.00%> (ø)
... and 24 more

codecov[bot] avatar Apr 07 '22 22:04 codecov[bot]

Thanks for fixing this!

RafalWilinski avatar Apr 13 '22 00:04 RafalWilinski

@nstepien Will this be merged to main do you think? I have used this fix for a while in a project now and it works fine as far as I can see. Would be nice to avoid my forked dependency :)

gkn avatar Sep 29 '22 10:09 gkn

@gkn it doesn't actually work though from my testing, the grid will steal focus when trying to focus something outside the grid while an editor is open Recording 2022-09-29 at 18 34 12

nstepien avatar Sep 29 '22 17:09 nstepien

I use an older fork with this PR https://github.com/gkn/react-data-grid

I need to click twice with the mouse on the input field outside the grid, and it will work. With the unpatched version of the grid, there is no way to keep focus outside the grid. Hope this might lead to a solution for you :)

gkn avatar Sep 30 '22 06:09 gkn