-
-
Notifications
You must be signed in to change notification settings - Fork 130
feat(web): implement doModifierPress ✨ 🎼
#15343
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
base: epic/web-core
Are you sure you want to change the base?
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
doModifierPressdoModifierPress 🎼
1bd3aa5 to
283f43f
Compare
5b3ea22 to
878b8ab
Compare
Fixes: #15287 Test-bot: skip
283f43f to
68de61a
Compare
doModifierPress 🎼doModifierPress ✨ 🎼
mcdurdin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about some of the modifier-related changes here, we should discuss
| if (this.activeKeyboard.isMnemonic && this.stateKeys['K_CAPS'] && (!e || !e.isModifier)) { | ||
| // Modifier keypresses don't trigger mnemonic manipulation of modifier state. | ||
| // Only an output key does; active use of Caps will also flip the SHIFT flag. | ||
| // Mnemonic keystrokes manipulate the SHIFT property based on CAPS state. | ||
| // We need to unflip them when tracking the OSK layer. | ||
| keyShiftState ^= ModifierKeyConstants.K_SHIFTFLAG; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this straight from jsKeyboardProcessor? I just don't quite understand the rationale - shift and caps have different effects on keys (e.g. 1 --> ! / 1 vs a --> A / A for shift and caps respectively)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's from jsKeyboardProcessor:
| if(this.activeKeyboard.isMnemonic && this.stateKeys['K_CAPS']) { |
| case Codes.keyCodes.K_RCTRL: | ||
| case Codes.keyCodes.K_LALT: | ||
| case Codes.keyCodes.K_RALT: | ||
| case Codes.keyCodes.K_ALTGR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a real AltGr. It's a pseudo AltGr that probably should never be used. See its keyCodes value of 50010. May need some further investigation!
| case Codes.keyCodes.K_ALTGR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this apply to all keycodes > 50000? If so, what are those? And we should probably add a comment to https://github.com/keymanapp/keyman/blob/feat/web/15287_doModifierPress/common/web/types/src/consts/virtual-key-constants.ts#L130
| case Codes.keyCodes.K_LSHIFT: | ||
| case Codes.keyCodes.K_RSHIFT: | ||
| case Codes.keyCodes.K_LCTRL: | ||
| case Codes.keyCodes.K_RCTRL: | ||
| case Codes.keyCodes.K_LALT: | ||
| case Codes.keyCodes.K_RALT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do not currently return true, so this is a functional change which would need extensive testing. I suggest we do not add them here unless we actually have a need for them, or else we audit all uses to ensure that adding these does not break anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| { code: Codes.keyCodes.K_NUMLOCK, name: 'NumLock' }, | ||
| { code: Codes.keyCodes.K_SCROLL, name: 'ScrollLock' }, | ||
| // TODO-web-core: should LSHIFT/RSHIFT etc also be detected as modifier? | ||
| // Currently .js keyboards don't don't support distinguishing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.js keyboards do support L/R alt and ctrl, but not L/R shift. We don't support L/R shift anywhere in Keyman.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
Fixes: #15287
Test-bot: skip