Closed jahorton closed 1 year ago
Test specification and instructions
Notes for further development:
Perusing the various ways this has been localized may provide some "fun" dev-testing material, since the string could end up longer in some languages.
The original style spec for Android's help bubble:
At this point, I've got the Web-side of the globe-key bubble pretty well fleshed out... at least aside from one detail.
Looking through the changes of #7473, there's one function in particular that's being a bit difficult to adapt: the Android-side dismissHelpBubble
:
To be explicit, the difficult parts are lines 1374 and 1376 - the return statements. The ability to note a need to redisplay the help bubble after keyboard changes or keyboard-backgrounding was used to keep the bubble's display to a reasonable minimum for user guidance, rather than constantly spamming it. The issue is... as the help bubble's active status is now managed Web-side, rather than Java-side, I'm not immediately clear on how best to restore that logic due to the complications posed by the WebView barrier.
Some of the use cases could easily be 100% managed on the Web side - restoring the help bubble after device rotation (so that it's properly sized and positioned for the new orientation) is such a case. However, code within the WebView isn't privy to knowledge of when the app / system-keyboard has been backgrounded and then restored - this case requires something extra.
I think we can probably be a bit more straightforward on the help bubble? We just dismiss it on first touch on the globe button, or else, say, 10 seconds after first display.
How do we record that it has been dismissed?
I don't think we ever need to show the bubble again after that first time.
I think we can probably be a bit more straightforward on the help bubble? We just dismiss it on first touch on the globe button, or else, say, 10 seconds after first display.
How do we record that it has been dismissed?
I don't think we ever need to show the bubble again after that first time.
We don't persist anything that says "we've shown this once before" that'll be available on future loads of the app, as if the process were killed and restarted.
Internally, there is a variable (KMKeyboard.ShouldShowHelpBubble
) that is set to true
on app load. It's auto-cleared if the corresponding toggle is off, and is also cleared once dismissed. That said, there are a couple of cases where dismissal will automatically re-display the hint:
And...
The problem noted in my previous comment: the "with the hint still active" part.
OK, so I'm not clear why the KMKeyboard.ShouldShowHelpBubble
isn't the flag we need?
How do we record that it has been dismissed?
I think it's these removed lines in KMManager.java from #7473
SharedPreferences prefs = appContext.getSharedPreferences(appContext.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(KMManager.KMKey_ShouldShowHelpBubble, false);
editor.commit();
@darcywong00 Revisiting the code removed by #7473...
(via release-16.0.84-alpha
)
What mechanisms would have caused the PopupWindow
to self-dismiss? It seems implied that a touch on it may have led to dismissal, but my best reads indicate the opposite - a touch anywhere else but on it would lead to dismissal.
I think a touch on the OSK leads to the globe key dismissal.
Okay, major update; I believe the basic functionality is now restored and in place. Jury's out on the styling though - there's almost certainly room for improvement there.
The two main parameters to tweak re: bubble shape:
fontSize
width
The bubble's CSS styling will handle all other aspects of the layout once those are set. Unfortunately, getting multiline text with tightly-constrained element width isn't exactly possible without lots of manual, fiddly, and complex logic.
Based on those two settings, the height of the bubble will dynamically increase as needed to wrap its text.
So... turns out the source files under web/source/osk/embedded
were all being included in the non-embedded build product. The latest commit disables this, which should resolve the file-size change warning-check.
Vice-versa as well, except we actually need the browser-oriented parts to be included for embedding in iOS.
Hmm, I'm trying this on Android 5.0 (API 21) and getting our fave console error
Uncaught TypeError: undefined is not a function
Sentry said line 6607 but I'm not seeing a culprit...
if (transformDistribution && transformDistribution.length > 0) {
editedToken.transformDistributions.push(transformDistribution);
if (this.searchSpace) {
this.searchSpace.forEach(function (space) { return space.addInput(transformDistribution); });
}
}
Sentry issue: KEYMAN-WEB-8A
Maybe the branch is stale and doesn't have the polyfills added from recent PRs?
Sentry said line 6607 but I'm not seeing a culprit...
forEach is Chrome 38+
Except that's set.forEach, not Array.forEach
So... turns out the source files under
web/source/osk/embedded
were all being included in the non-embedded build product. The latest commit disables this, which should resolve the file-size change warning-check.
Nice, I think the check/web/file-size
status check has just paid for itself!
Maybe the branch is stale and doesn't have the polyfills added from recent PRs?
yeah, I merged locally with beta and the console log is now clear
3,398 bytes smaller, now 390,858 bytes!
Maybe the branch is stale and doesn't have the polyfills added from recent PRs?
This. I noticed a number of related omissions when doing the diff checks that led to my discovery of the embedded code's inclusion.
TEST_CLEAN_INSTALL_BUBBLE (PASSED): Tested with the attached PR build in my Android Mobile device (Redmi Note 8 Pro / Android 11 ) and here is my observation: 1.Installed Keyman App in a clean device. 2. Verified that the help bubble immediately appears after launching Keyman.
TEST_BUBBLE_ROTATION_HANDLING (PASSED): In the Portrait mode, re-opened Keyman app. Verified that the bubble appears after a2 second delay. Changed the device position from Portrait to Landscape. Verified the bubble immediately appears on the view.
TEST_BUBBLE_DIRECT_DISMISSAL (PASSED): 1. In the Portrait mode, re-opened Keyman app. Verified the bubble appears after 2 second delay. Tapped the location that the help bubble is overlapping an output key for the keyboard and verified that the bubble disappeared and no text output appears on the view. 2. Changed the device position from Portrait to Landscape mode. Verified that there is no help bubble appears on the view. 3. Reopened Keyman app and verified that the help bubble re-appeared after 2 second delay.
TEST_BUBBLE_KEY_DISMISSAL (PASSED): 1. In the Portrait mode, re-opened Keyman app. Verified that the help bubble appears after 2 second delay. Pressed a key that the help bubble is not overlapped with it. Verified that the help bubble is dismissed and the pressed key outputs the correct text. 2. Changed the device position from Portrait to Landscape mode and verified that the help bubble did not appear on the view. 3. Reopened Keyman app and verified that the help bubble re-appeared, after 2 second delay.
TEST_POST_INSTALL_BUBBLE (PASSED): 1. In Portrait mode, re-opened Keyman app. Verified the bubble appears after 2 second delay. 2. Installed "Amharic" (gff_amharic) keyboard from Settings menu. Verified that the help bubble re-appears, after a 2 second delay. Verified that the gff_amharic keyboard is the active keyboard and the Help bubble is fully visible on the left screen.
TEST_BUBBLE_POST_SWAP (PASSED): 1. Tapped the globe key, while the help bubble still appears on the screen. Noticed that the Keyboards has been changed to sil_euro_latin (default keyboard). Verified that the help bubble disappeared on the screen. 2. Re-opened the Keyman app and noticed that the help bubble did not appear on the screen.
Changes in this pull request will be available for download in Keyman version 16.0.110-beta
Fixes #7497.
This implements the old, Android-code-based globe key help bubble as a Web-side, DOM-based help bubble via JS and CSS.
Current implementation:
For comparison against the old implementation, it's probably best to review this PR in tandem with the removed code from #7473. There are a few notable changes here, though...
isHelpBubbleEnabled
,setHelpBubbleEnabled
remain deprecated. Looking at #7473... I couldn't discern what role they actually played.getShouldShowHelpBubble
andsetShouldShowHelpBubble
as wrappers for the private propertyShouldShowHelpBubble
that did exist in #7473.getShouldShowHelpBubble
facilitates "lazy initialization"; this allows a library consumer to override the engine-default value if desired, before any logical checks against the property are performed.A quick note of the desired behaviors I could identify:
Cases that should show the help bubble:
Cases where if it is still displayed, it should be hidden, then redisplayed:
Cases where hiding the help bubble should result in permanent dismissal:
Cases where hiding the help bubble should dismiss the bubble for the lifetime of the keyboard... but not permanent:
User Testing
If the following tests are performed in order, without interruption, a clean install should only be required once, for the first test. Otherwise, a clean install should be performed when resuming tests after a break. (Steps 1-3 of
TEST_CLEAN_INSTALL_BUBBLE
correspond to such a "clean install.")Do not directly swap keyboards unless otherwise instructed!
Tests should be carried out on a real Android phone if possible.
TEST_CLEAN_INSTALL_BUBBLE: With a fresh install of the Keyman app, ensure that the help bubble is displayed on app start.
TEST_BUBBLE_ROTATION_HANDLING
TEST_CLEAN_INSTALL_BUBBLE
before proceeding.TEST_BUBBLE_DIRECT_DISMISSAL
TEST_CLEAN_INSTALL_BUBBLE
before proceeding.TEST_BUBBLE_KEY_DISMISSAL
TEST_CLEAN_INSTALL_BUBBLE
before proceeding.TEST_POST_INSTALL_BUBBLE
TEST_CLEAN_INSTALL_BUBBLE
before proceeding.gff_amharic
.gff_amharic
is now the active keyboard.TEST_BUBBLE_POST_SWAP
TEST_POST_INSTALL_BUBBLE
or repeat that test's steps before proceeding!sil_euro_latin
(the default keyboard).NOTE: once
TEST_BUBBLE_POST_SWAP
is completed, a clean install will be required to re-run any of these tests on the device used for testing!