AXElements/accessibility_keyboard — pull request #2 by jonnyyu (2014-08-22 14:38:38+00:00)
Title: Fix Fn key is still pressed after typing arrow key

repro steps:
1. open Mac OS X’s Keyboard viewer.
2. run AXElement script below:
require ‘ax_elements’
app = AX::Application.new ‘com.apple.TextEdit’
set_focus_to app
type ‘\\DOWN’
type ‘(‘

After typing ‘(‘, from keyboard viewer, the ‘Fn’ key is still in
pressed state.

It looks like a Mac OS CGEventCreateKeyboardEvent’s bug. Currently the
workaround is to force unset ‘Fn’ flag after creating the event for arrow keys.