Closed azimgd closed 1 year ago
Built a production app and faced the same issue https://github.com/Expensify/App/pull/14767#issuecomment-1424833574 https://github.com/Expensify/App/pull/14767#issuecomment-1427092940. I suspect it might be related to OS.
@luacmartins Can you please help with the following?
Asking for help on Slack https://expensify.slack.com/archives/C01GTK53T8Q/p1677264003502069.
Sorry, I've been focused on a roadmap project and the ECX presentation so I haven't been able to prioritize this. I'll try to get back to it next week!
No problem. Thanks.
2. Testing shortcuts on iOS App on a real device. I can't run it on the simulator.
@parasharrajat Do you still need help?
@alexxxwork Yeah, that is still remaining.
Tested this PR on a hardware device with bluetooth keyboard attached. Key combos work (ctrl + I, ctrl + K, ctrl + shift + K ).
2023-02-28 08:27:03.774 25142-25142 unknown:ReactNative com.expensify.chat E Tried to remove non-existent frame callback
I don't see such a behaviour on search modal https://github.com/Expensify/App/pull/14767#issuecomment-1427092940 But there's another strange thing:
Thanks,@alexxxwork. You have similar results like mine. This will really help.
Cc @azimgd.
Hey @alexxxwork, thank you for a quick feedback.
ESC doesn't work reliably - sometimes it's just closing the app and brings you to home screen.
I believe this happens on a home page, right? Pressing ESC on a home page will minimize the app per Android OS.
Can't manage to test Enter shortcut. It just closes popup on submit attachment window, you should select submit button with TAB.
Could you confirm if pressing ENTER doesn't send an attachment in the popup before closing it? We don't support pressing Tab to focus on elements.
Arrow keys work strange on a report page - up key scrolls down through chat messages and down key scroll up.
While I haven't noticed this behavior, Flatlist on a (home) report page is not wrapped with a keyboard subscription library and operates fully on a native side.
I don't see such a behaviour on search modal https://github.com/Expensify/App/pull/14767#issuecomment-1427092940
But search modal is wrapped.
In the end of the searh list selection behaves in a strange way - two elements are highlighted. This happens only for the first time. Next round of scrolling is ok.
Same with this one, keyboard subscription is interfering with a FlatList.
I believe this happens on a home page, right? Pressing ESC on a home page will minimize the app per Android OS.
Not only homepage, but any popup in App. Seems like an app crash. It looks like an error calling back
.
Could you confirm if pressing ENTER doesn't send an attachment in the popup before closing it?
Yes it doesn't
But search modal is wrapped.
I mean that I don't see problems, that @parasharrajat reported here - search elements scroll with arrow keys works just ok.
While I haven't noticed this behavior, Flatlist on a (home) report page is not wrapped with a keyboard subscription library and operates fully on a native side.
I think this should be fixed maybe in another issue
Thanks for helping with tests @alexxxwork!
Every time you see a popup you should press TAB to make a selection with keyboard arrow keys
It happened to me on New Chat or New Group Page.
Arrow keys work strange on a report page - up key scrolls down through chat messages and down key scroll up.
Scrolls the whole chat list for me.
I think that for us native keyboard handling is interfering with custom shortcuts. For example, on the web, arrow keys normally will scroll the list and there are other shortcuts as well that are native to OS. I think the same thing is happening when a Hardware keyboard is attached to the device. OS detects the keyboard and enables native shortcuts like scrollable list scrolls with arrow keys, and tab keys.
It might not be happening if we are using a Bluetooth keyboard. I believe that the code is correct but there might be edge cases based on OS. Mine is MiUI.
Can we utilize BrowserStack to test this? Need to check.
For example, on the web, arrow keys normally will scroll the list
@parasharrajat You're right, arrow keys works on web just the same - up/down reversed.
I think that ESC
and Enter
issues should be fixed and also "keyboard focus" in popups. Arrows are another issue or maybe feature not bug π
Hey @alexxxwork would you mind checking this again and see if the latest update fixed "Enter" and "Escape" bug you had.
@azimgd Still there's problem with popups (you need to press Tab
and then make a selection)
Enter shortcut works now in upload attachment modal π
ESC
bug is still here. Pressing Ctrl-K
then ESC
brings me to phone home screen. Ctrl + I
+ ESC
works ok.
The error in Android Studio's logcat is the same Tried to remove non-existent frame callback
Hey @alexxxwork, let's try to clarify some points from your feedback.
@azimgd Still there's problem with popups (you need to press Tab and then make a selection)
I'm not going to count this as a bug unless Carlos or Rajat has a very strong argumentation. It's a feature request since initial implementation was done for web only.
ESC bug is still here. Pressing Ctrl-K then ESC brings me to phone home screen. Ctrl + I + ESC works ok.
Would you mind checking this on main branch please? I think what you have there is an interference with native OS functionality. Shortcut popup (ctrl + i) is a modal while Search popup (ctrl + k) is a page.
Hope I addressed all outstanding comments.
I'm not going to count this as a bug unless Carlos or Rajat has a very strong argumentation. It's a feature request since initial implementation was done for web only.
@azimgd I've just took a look at the original issue. 32k for this issue that's huge π I think @parasharrajat should clarify the amount of work to be done on this issue.
Would you mind checking this on main branch please?
Tested on release from google play. Obviously Ctrl+K
don't work. But ESC
from pages (settings, group chat, etc.) works correctly. So I suppose this is a bug in your implementation.
Do you need help solving this ESC
problem?
@azimgd I've just took a look at the original issue. 32k for this issue that's huge π
Not sure I understand this part.
Tested on release from google play. Obviously Ctrl+K don't work. But ESC from pages (settings, group chat, etc.) works correctly. So I suppose this is a bug in your implementation.
Looking at this.
Thanks @alexxxwork for continued feedback. I won't suggest investing time into this anymore if you are expecting compensation. Because I can't guarantee that.
Obviously, we will chase all the bugs or inconsistencies that are present on this PR.
But the main focus is to land the first working draft. Every shortcut should at least work. Edge cases can be tackled later.
Not sure I understand this part.
@azimgd congratulations on winning an issue worth of $32k.
@parasharrajat I understand this. Anyway I can test this PR a few times more, not a problem.
As I mentioned above ESC is interfering with native OS based implementation. There are couple of ways solving this but not directly related to the work being done in this PR.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// disabling hardware ESCAPE support which acts as a button
if (keyCode == 111) { return false; }
KeyCommandModule.getInstance().onKeyDownEvent(keyCode, event);
return super.onKeyDown(keyCode, event);
}
Skipping this as it's not related to: "Allow keyboard shortcuts to work on native devices"
@azimgd @parasharrajat if you need my opinion here, I think that QA test steps for this PR should work without errors, but they don't for now:
Note: you need to connect hardware keyboard to test mobile keyboard shortcuts.
@alexxxwork you were absolutely right about the ESC button, which was broken after "ENTER" support fix. This should be fixed now. Thank you.
Do we have any unresolved points left from your feedback ?
@azimgd Actually it was broken before ENTER
fix, the first time I tested it.
Enter
and ESC
works ok now π
tested all these QA steps.
There's also a minor edge case. When you press Enter
in a "search" sidebar it closes the page, but I think it shouldn't. Maybe this is a side-effect of the previous Enter
fixing commit https://github.com/Expensify/App/pull/14767/commits/10a080eab1c68bdebdfe0d8bc3b777b892cb21c2
@parasharrajat if you need my opinion for native keyboard navigation in general - it's hard to use it whithout right assigned tabindexes. When you use it in a dialog it's hard to switch to text input using keyboard only because you got to scroll ALL messages.
When you press Enter in a "search" sidebar it closes the page, but I think it shouldn't. Maybe this is a side-effect of the previous Enter fixing commit
This seems to be the behavior on main too, so I think we can tackle it as a separate PR! Thanks for all the testing @alexxxwork!
@azimgd would you mind fixing the conflicts so we can do a final review?
This seems to be the behavior on main too, so I think we can tackle it as a separate PR!
@luacmartins Should I first report this as a bug?
Go for it @alexxxwork
@luacmartins Can you please test this on ioS? I guess it needs to build an app on iOS. Maybe add the label ready to build
to help us test it out.
I triggered the testing builds. We still have conflicts though
@azimgd Please merge main.
@luacmartins I get "This app cannot be installed because its integrity could not be verified."
note: "developer mode" is enabled on my device.
I'm building a new version for testing since we merged main and resolved conflicts. I posted in Slack about the iOS integrity issue.
Same error. Are you able to run it on your end?
No, I get the same error
Could you try building it manually from your machine?
@azimgd gonna look into this now. Meanwhile, some jest tests are failing on this branch, you might wanna take a look at that.
Tests are failing on main.
I will be mostly unavailable starting this Thursday, for about a month. I will appreciate if we can get this merged within next 2 days.
@azimgd tests on main seem to be passing for me. I also see recent PRs, e.g. this one where tests are passing.
@azimgd we tested on android and iOS but had a few issues:
Android
CMD + SHIFT + K
doesn't seem to workCMD + I
opens the shortcut modal, but immediately closes itiOS
That should be ctrl, not cmd right?
Correct!
@alexxxwork ctrl + shift + k
was working for your right ?
@azimgd an update. ctrl + shift + k
seems to be working for me now, not sure why it didn't before.
I'm still having issues with ctrl + i
though. It seems like when I release the keys before the animation finishes, it closes the modal right away. However, if I keep the keys pressed until after the animation is over, the modal stays open.
@azimgd Never mind, ctrl + i
seems to work fine now. Maybe it's an issue with my device + keyboard π€
So only the issue with iOS remains. I'm testing that again now.
@alexxxwork
ctrl + shift + k
was working for your right ?
yeah, all worked ok.
Could you please check if the commit above fixes iOS ?
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.
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
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
https://user-images.githubusercontent.com/4882133/217061211-7b10e95f-ca0c-46b1-bec7-64d143e0df37.movMobile Web - Chrome
https://user-images.githubusercontent.com/4882133/228418338-0c398127-98ba-43c6-a8f8-217a0ede50a6.movMobile Web - Safari
https://user-images.githubusercontent.com/4882133/228415502-02486d6c-e8a6-4e30-92bb-2ebd9260064d.mp4Desktop
https://user-images.githubusercontent.com/4882133/217061108-29148272-46de-4c5d-ae54-c5107f1d8927.moviOS
https://user-images.githubusercontent.com/4882133/228414893-628d999f-0e2c-4de5-82ba-2b30dbb5734c.mp4Android
https://user-images.githubusercontent.com/4882133/216602144-6bc2ee7f-80f3-4578-bd92-cda60d071d29.MOV