A keypress becomes a light-sensing event

Inside an optical switch, a tiny infrared emitter sends light across a gap toward a sensor. The key’s plastic stem carries a moving part—often a small tab—that crosses that gap as the key is pressed. When the tab blocks the beam, the sensor detects the change and the keyboard’s controller registers a press.

The light is infrared, beyond the range of human vision, so the key does not visibly flash. The sensor and controller turn the interruption into an electrical signal the computer can understand; the computer still receives an ordinary keystroke, not a beam of light.

What changes compared with a contact switch

In a conventional mechanical switch, moving metal contacts meet to complete an electrical circuit. An optical switch can register the press without those contacts touching: the stem changes what reaches the sensor, and the controller interprets that change. A spring still pushes the key back up, and the switch still has moving parts, but the sensing step relies on light rather than a closing contact.

That difference matters most at the point where a press is detected. The switch’s shape determines when the stem crosses the beam, while its electronics determine how that sensor change becomes a keystroke. The key is still a mechanical object; it is the method of detection that is optical.