Learning UWP Keyboard Navigation
After a quick review of the of UWP keyboard event basics, I opened up the can of worms that is keyboard navigation. I stumbled into this because I wanted to use arrow keys to move the 3D printer carriage holding a camera, but arrow keys already have roles in an application framework! My first effort to respond to arrow keys was a failure, and I hypothesized that my code conflicted with existing mechanisms for arrow keys. In order to figure out how I can write arrow key handlers that coexist with existing mechanisms, I must first learn what they are.
Graphical user interfaces are optimized for pointing devices like a mouse, stylus, or touchscreen. But that's not always available, and so the user needs to be able to move around on screen with the keyboard. Hence the thick book of rules that is summarized by the UWP focus navigation page. As far as I can tell, it is an effort to put together all the ways arrow keys were used to move things around on screen. A lot of these things are conventions that we've become familiar with without really thinking about it as a rigorous system of rules, many were developed by application authors so it "felt right" for their specific application. It reminds me of the English language: native speakers have an intuitive sense of the rules, but trying to write down those rules is hard. More often than not, the resulting rules make no sense when we just read the words.
And, sadly, I think the exact same thing happened in the world of keyboard navigation. But in a tiny bit of good news, we're not dependent on understanding words, this page also had a lot of animated graphics to illustrate how keyboard navigation functions under different scenarios. I can't say it makes intuitive sense, but at least seeing the graphics help understand the intent being described. It's especially helpful in scenarios where tab navigation interacts with arrow key navigation.