Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
2.99k stars 2.5k forks source link

Allow keyboard shortcuts to work on native devices #14767

Closed azimgd closed 1 year ago

azimgd commented 1 year ago

Details

Fixed Issues

$ https://github.com/Expensify/App/issues/6883 PROPOSAL: https://github.com/Expensify/App/issues/6883

Tests

Offline tests

Same as QA Steps.

QA Steps

Note: you need to connect hardware keyboard to test mobile keyboard shortcuts on iOS and Android.

  1. Press CMD + K to open "search" sidebar
  2. Press CMD + SHIFT + K to open "newGroup" sidebar
  3. Press CMD + I to open "shortcut" dialog
  4. Press ESC to close any sidebar or dialog
  5. Press ENTER to submit attachment dialog

https://github.com/Expensify/App/blob/ef6937c38197da7124341faefd2218260da7effe/src/CONST.js#L231-L282 All of the shortcuts here should work on Web.

List of known issues on Android and iOS: https://github.com/Expensify/App/pull/14767#issuecomment-1494158230 which are not counted as regressions.

PR Author Checklist

Screenshots/Videos

Web https://user-images.githubusercontent.com/4882133/217061211-7b10e95f-ca0c-46b1-bec7-64d143e0df37.mov
Mobile Web - Chrome https://user-images.githubusercontent.com/4882133/228418338-0c398127-98ba-43c6-a8f8-217a0ede50a6.mov
Mobile Web - Safari https://user-images.githubusercontent.com/4882133/228415502-02486d6c-e8a6-4e30-92bb-2ebd9260064d.mp4
Desktop https://user-images.githubusercontent.com/4882133/217061108-29148272-46de-4c5d-ae54-c5107f1d8927.mov
iOS https://user-images.githubusercontent.com/4882133/228414893-628d999f-0e2c-4de5-82ba-2b30dbb5734c.mp4
Android https://user-images.githubusercontent.com/4882133/216602144-6bc2ee7f-80f3-4578-bd92-cda60d071d29.MOV
melvin-bot[bot] commented 1 year ago

@andrewgable Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

parasharrajat commented 1 year ago

Please correct the linking image

Directly paste the link to the issue after the dollar

$ https://github.com/Expensify/App/issues/6883
azimgd commented 1 year ago

@luacmartins @parasharrajat I kept original structure of KeyboardShortcut and added RNKeyCommand integration on top of that.

We also need to merge https://github.com/Expensify/react-native-key-command/pull/15 and update version here.

azimgd commented 1 year ago

FYI: arrow up/down is broken on main: https://expensify.slack.com/archives/C049HHMV9SM/p1675634800267959

azimgd commented 1 year ago

Electron desktop fix (tested): https://github.com/Expensify/react-native-key-command/pull/17. This fix needs to be deployed before Electron is tested.

azimgd commented 1 year ago

Tested on Android and Web. Everything is ready for review.

luacmartins commented 1 year ago

Electron desktop fix (tested): https://github.com/Expensify/react-native-key-command/pull/17. This fix needs to be deployed before Electron is tested.

0.7.0 is published!

azimgd commented 1 year ago

@parasharrajat have you started to review this ?

parasharrajat commented 1 year ago

Yup. A little busy with some stuff but I will share updates today.

parasharrajat commented 1 year ago

I will share the update in some time. I am currently AFK.

azimgd commented 1 year ago

@parasharrajat Can we set an exact timeframe and stick to this please ? Given dates are missed over and over again. We can agree upon a schedule that suits you and work together if you would like. Happy to help so we can get this finished asap.

parasharrajat commented 1 year ago

I am back now. Give me 20 mins and I will continue on this issue. Hope that works for you.

azimgd commented 1 year ago

Thanks, I will be available for the next 5-6h.

parasharrajat commented 1 year ago

Checking now.

parasharrajat commented 1 year ago

So the question is do we need a close icon on the modal on native? Normally, all of our native modal/popover are bottom docked. But I agree it is a little different. Let me try a few different variants first.

parasharrajat commented 1 year ago

BUG: Android: Escape key does not close the Search page opened via shortcuts in Native. Does it have different behavior on native?

Steps:

  1. Open the app on Android.
  2. Press Ctrl + K to open the search page from the hardware keyboard.
  3. Press Escape to close it.

BUG: Android: Arrow keys are not traversing the search page list.

Steps:

  1. Open the app on Android.
  2. Press Ctrl + K to open the search page from the hardware keyboard.
  3. Use the Arrow keys.
azimgd commented 1 year ago

BUG: Escape key does not close the Search page opened via shortcuts in Native. Does it have different behavior on native?

Which device, hardware keyboard ?

parasharrajat commented 1 year ago

Added more details. I am running the app on a real android device with keyboard attached with OTG.

azimgd commented 1 year ago

BUG: Android: Arrow keys are not traversing the search page list.

FYI: arrow up/down is broken on main: https://expensify.slack.com/archives/C049HHMV9SM/p1675634800267959

parasharrajat commented 1 year ago

This is working on the web on this branch and staging for me. May be desktop has some problem. haven't tested it yet.

azimgd commented 1 year ago

BUG: Android: Escape key does not close the Search page opened via shortcuts in Native. Does it have different behavior on native?

Just tested this and this is working for me: https://user-images.githubusercontent.com/4882133/216602144-6bc2ee7f-80f3-4578-bd92-cda60d071d29.MOV

azimgd commented 1 year ago

BUG: Android: Arrow keys are not traversing the search page list.

Fixed

azimgd commented 1 year ago

Make sure to "unfocus" from text input by pressing enter, when testing Arrow keys.

parasharrajat commented 1 year ago

Can you please update the about page to also show the option for View keyboard shortcuts on native?

azimgd commented 1 year ago

Please rephrase, "about page" you mean the popup triggered on CTRL+K ?

parasharrajat commented 1 year ago

Go to Settings > About menu > there you will see View keyboard shortcuts on web. https://staging.new.expensify.com/settings/about

azimgd commented 1 year ago

done.

parasharrajat commented 1 year ago

Make sure to "unfocus" from text input by pressing enter, when testing the Arrow keys.

Android: The arrow keys are not working reliably. They only select one user and then does not work. If I press Tab once, then the arrow keys select one more user. I can repeat Tab and arrow down pattern a few times.

parasharrajat commented 1 year ago

Before I continue, can you please complete the checklist? And fix the videos.

azimgd commented 1 year ago

Reproduction steps please:

doesn’t work ?

azimgd commented 1 year ago

Before I continue, can you please complete the checklist? And fix the videos.

I’m not able to test on ios device, waiting for @luacmartins to deploy.

could we clear everything except ios today please?

azimgd commented 1 year ago

If any new file was added I verified that:

Only 2 new files were added into bindHandlerToKeydownEvent folder, and are self explanatory with comments on top, so I'm going to check this as well.

Everything else except iOS is checked in the "PR Author Checklist".

parasharrajat commented 1 year ago

Talked to azim 1-1 to explain him the arrow key problem. It seems to be working fine for me. I will try to get better reproduction steps tomorrow.

FYI @azimgd, tests are failing too.

parasharrajat commented 1 year ago

Continuing testing now.

parasharrajat commented 1 year ago

There was a further discussion today on this PR. We are still stuck on the Arrow key issue. I will post the videos for these tomorrow and do some digging from my side. Hopefully, those are just setup issues and we will be good to close this in the next few days.

parasharrajat commented 1 year ago

Here is the video of the bug report.

https://user-images.githubusercontent.com/24370807/218328082-0af932a5-2316-454a-af43-63c07e16678e.mp4

parasharrajat commented 1 year ago

@azimgd Please merge the main as well. There are some breaking changes for react-native-reanimated.

azimgd commented 1 year ago

That's the side effect of communication over bridge while it's overfilled + RN is busy with other calculations (Onyx, Component updates etc.). There are no other improvements I can do to speed this up for your case, beside adding JSI support. Please try production build which should be much better than this. cc @luacmartins

parasharrajat commented 1 year ago

Ok, let me test the production build.

parasharrajat commented 1 year ago

Could you merge main into this?

azimgd commented 1 year ago

I will merge main right after full testing/review cycle is accomplished and I get a complete feedback list with everything you found in one batch. I'm positive that this PR doesn't interfere with reanimated update. I don't currently have a capacity to merge and retest until we decide on the current state for this PR as this was supposed to get done a while ago.

azimgd commented 1 year ago

Can I get a status update ?

parasharrajat commented 1 year ago

No update for now. But there will be one soon.

parasharrajat commented 1 year ago

I am traveling today so can't share any updates. Surely, I will be able to do it tomorrow. let's get this wrapped up.

azimgd commented 1 year ago

Can I get an update please ?

parasharrajat commented 1 year ago

Hoping to do it today. Can you please merge the main into this? Apologies for the delay, travelling is tiring.

azimgd commented 1 year ago

https://github.com/Expensify/App/pull/14767#issuecomment-1430283541

Rajat, I can spend time and keep merging main if you can keep your estimates intact. So far most of your estimates were delayed for days / weeks.

@luacmartins May I ask for some involvement from your side as well here? How can we improve this process?

parasharrajat commented 1 year ago

Yes, For long and time taking issues, I think it should be expected. There were multiple PRs. I understand that you have two tasks at your hand and you want them to be completed asap. But as this issue is open for me for a long time, priorities have been shifted many times.

There have been times when I was available but you were not. There have been also delays during previous PRs. I understand that you might be busy with other stuff but I expect the same from you as well.

The last update was https://github.com/Expensify/App/pull/14767#issuecomment-1430202337 a week before from me. But due to other important work being pushed in, I had to manage.

Hopefully, if things are working well, it should be approved soon. I have been trying iOS for some time but no luck on the simulator.

How can we improve this process?

parasharrajat commented 1 year ago

So, I think if you can merge the main into this and add tests, It will also help.

image

parasharrajat commented 1 year ago

Screenshots

:black_square_button: iOS / native

No luck.

:black_square_button: iOS / Safari

Screenshot 2023-02-24 22:08:07

:black_square_button: MacOS / Desktop

https://user-images.githubusercontent.com/24370807/221195712-406a566a-dabf-4297-aa3a-116af83c1edc.mp4

:black_square_button: MacOS / Chrome

https://user-images.githubusercontent.com/24370807/221189489-20caeb05-7f8c-4ba8-a0f7-b1bf683ba1aa.mp4

:black_square_button: Android / Chrome

:black_square_button: Android / native