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

Ignore Alt Gr key, by blacklisting modifier keys, in KeyTips detection #642

Merged
merged 1 commit into from
Sep 27, 2018
Merged

Ignore Alt Gr key, by blacklisting modifier keys, in KeyTips detection #642

merged 1 commit into from
Sep 27, 2018

Conversation

stylefish
Copy link
Contributor

This fixes that if the key "alt gr" is pressed for about 1-2 secs and then another key e.g. "" on a germany keyboard layout is pressed the backslash is not correctly routed to a text input but gets processed by the keytip service.

steps to reproduce:

  • open the showcase app
  • select the tab "Tests" and click into the "KeyTip issues" textbox
  • hold down "Alt Gr" for about 2 seconds
  • try to enter any letter reachable via Alt Gr [e.g. a backslash ""]

if i should create an issue or if you want me to change the source code of this pull request feel free to contact me, i'm happy to change it according to your specs :)

@batzen
Copy link
Member

batzen commented Sep 26, 2018

I don't get why we should use some blacklist here.
Just checked behavior in word and Alt Gr (right alt) just doesn't work as an activation key for key tips.
Wouldn't the better solution be to just remove that key from DefaultKeyTipKeys?

@stylefish
Copy link
Contributor Author

stylefish commented Sep 26, 2018

Alt Gr is composed by "Ctrl+Alt" so Ctrl is the whats doing the job here. Alt Gr does not exist on a Keyboard with US Layout, so i guess the right alt key is just alt.
I introduced the blacklist to remove all modifier keys, because every time a modifier key is pressed together with an KeyTip activation key the activation is invalid.

you could - to fix the problem - check only for left/right Ctrl at this point, but removing a key from the collection does not fix this issue and will maybe introduce other unwanted behaviors on other keyboard layouts. Furthermore i thought the KeyTips may be changed from the outside (e.g. by a dev using fluent ribbon) thats why i introduced the blacklist and am removing the modifier keys (Alt) that are explicitly triggering the KeyTip mode.

i could change the code to if (Keyboard.IsKeyPressed(Key.LeftCtrl) || Keyboard.IsKeyPressed(Key.RightCtrl)) return false; but i think this way it covers all cases, even if the KeyTip activation keys are changed from outside.

just let me know what to change :)

@batzen
Copy link
Member

batzen commented Sep 26, 2018

Uh, your points are very valid. Hadn't thought about these situations. Just let me think a bit about it.

@batzen batzen merged commit 89b9ea9 into fluentribbon:develop Sep 27, 2018
@batzen batzen changed the title ignore Alt Gr key in KeyTips detection Ignore Alt Gr key, by blacklisting modifier keys, in KeyTips detection Sep 27, 2018
batzen added a commit that referenced this pull request Sep 27, 2018
batzen added a commit that referenced this pull request Sep 27, 2018
@batzen
Copy link
Member

batzen commented Sep 27, 2018

Merged and improved it a bit afterwards.
Thanks for contributing again!

@stylefish stylefish deleted the altgrkeytip branch October 4, 2018 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants