Refactor keyboard example to use viewports