Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofocus / auto input doesn't work on Firefox browser? #192

Open
barnij opened this issue Jan 7, 2022 · 8 comments
Open

Autofocus / auto input doesn't work on Firefox browser? #192

barnij opened this issue Jan 7, 2022 · 8 comments
Labels
bug Something isn't working firefox

Comments

@barnij
Copy link

barnij commented Jan 7, 2022

Hi! Thank you all for contributing to this project! I got a weird problem and would be grateful for any help. When I start typing inside the cell on Chrome browser, spreadsheet automatically switches to editor mode and puts a letter in the input field. On Mozilla Firefox, key pressing turns on edit mode, but I have to press another key to start typing. You can see that default effect on author's page: https://iddan.github.io/react-spreadsheet/ Is there any way to reproduce Chrome behavior in Firefox?

@iddan
Copy link
Owner

iddan commented Feb 5, 2022

I am not sure but this sounds like a bug. I don't have the bandwidth to triage it right now (sorry for the late response). PRs are welcome!

@iddan iddan added bug Something isn't working firefox labels Feb 5, 2022
@cayman1066
Copy link

Fantastic project! I've got the same Firefox issue that @barnij reported. Another side effect of Mode defaulting to 'view' is that I cannot paste any data into the spreadsheet, which I can do in Chrome. As a work around, I was hoping to find way to manually set Mode to 'edit' on focus, but I cannot find any way to do this. Any chance you will find the bandwidth to triage this?

@Lucas-Bezerra-Santos
Copy link

@iddan
some updates on this bug?

@iddan
Copy link
Owner

iddan commented Sep 18, 2023

I haven't researched it further. PRs are welcome 🙏

@isimonsm
Copy link

Hi @iddan, thank you for the cool project!
I was digging into this issue and figured out that it results from the keypress event being handled differently in firefox compared to chrome. The issue can be resolved by replacing the onKeyPress event handlers with onKeyDown event handlers. The keypress event is deprecated anyways. You can check out the difference in this simple example: https://stackblitz.com/edit/vitejs-vite-rvc3re?file=src%2FApp.tsx

Would you be able to make this change? I would be willing to implement it, but I am unsure if there is a reason you separated the onKeyDown and onKeyPress event handlers I am not seeing.

@iddan
Copy link
Owner

iddan commented Nov 1, 2023

Hey @isimonsm, The code I wrote for onKeyPress was done a long time ago so I'm not really sure why did I do it that way but not sure there's a good reasoning for that. I would love to review a PR that fixes it.

@Yohh
Copy link

Yohh commented Nov 22, 2023

@iddan hi, nice work! is it ok if we add a setMode props to enable "edit" or "view" and render directly the DataEditor instead of DataViewer if we want ?

actually mode is readonly and cannot be changed by default

@isimonsm I've try to remove onKeyPress and totally replace it with onKeyDown, it doesn't solve anything, I'm still convinced that the real problem is about the mode staying "view" in firefox even with a key press

@iddan
Copy link
Owner

iddan commented Jul 7, 2024

Hey @Yohh, sorry for the very late response. Is this still relevant for the newest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working firefox
Projects
None yet
Development

No branches or pull requests

6 participants